can i used craft.entries.section into my Controller I am new in Craft CMS and this is my first plugin. Below is my code to get products.

{% craft.entries.section('products').limit(9) %}


This code is working fine but can I use this code in my controller for getting products?

Thanks
If you want to use ElementCriteria in your controller, this is how to go about it:

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section('products');
$criteria-&gt;limit = 9;

$products = $criteria-&gt;find();


Read this page for more info on the subject.