php - CakePHP: Paginate on Contained Array -


I have a lot of code associated with categories but a product There is only one category.

In my category view, I have a list of all the products specified in that particular category and the output is in the table. I am attempting to endorse this table because it can easily grow in size

My Controller, View Action:

  Public function admin_view ($ id = null) {If (! $ Id) {$ this- & gt; Redirect ('/ admin / categories');} $ range = $ this- & gt; Category-> Find ('first', array ('conditions' => array ('Category.id' = & gt; $ id), 'contain' = & gt; array ('product')); If (! $ Range) {$ this- & gt; Redirect ('/ admin / categories'); } And {$ this- & gt; Set ('category', $ range);  
  • Category model: many = array in public $ ('product');
  • Product model: is related to public $ = 'category';

It outputs data with a range array with all product data and all the products associated with this particular category:

Question: How can I portray the page Which product list do I have in my categories as a table? Admin_view view?

  $ this->; Paragater-> Settings = Array ('Terms' = & gt; Arrays ('category id =' = ID; $ id), 'included' => array ('product'), 'border' => 25); $ Range = $ this- & gt; Paginated ('category');  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -