php - Maximum amount of items in one Page of Yii -


I am developing this yii application and displaying "preview" of these items in the index and currently it 8 is displayed item so it will pave yourself. I would like to make it a page on every 4 items and I have searched online and found that I can use cepagation. I have followed the example in the documentation and it is working but I do not know how to show the model, I have the following code in the index.

  foreach ($ Model $ as model): endoirch; $ This- & gt; Widget ('CLinkPager', array ('page' =>; $ pages,)); Besides that the data I want to display is the title, content, image and id and I can use  _view  because I have about CSS Everyone is set in  

In addition to this, it is a way to display the index with CLISIviVe by defining the yii application, where I can set the item limit instead of using CPIgnition

If you want to display 4 items only on the index page, edit this type of index edit:

  Public Function ActionIndes () {$ DataProvider = New Cactivet Provider ('{Model}', array ('criteria' = & gt; array ('select' = & gt; 'title_field, content_field, image_field', 'limit' = & gt; {border} ))); $ This- & gt; Render it ('index', array ('data provider' =>; $ dataspreader,)); }  

This code will return the {Limit} model from the database, if you want to sort them from any area, then you need to add 'order' to the criteria array such as:

  'criteria' = & gt; Array ('Select' = & gt; 'title_field, content_field, image_field', 'order' = & gt; 'download_id DESC', 'border' => {border},)  
and partially present to render _view.

  foreach ($ Model $ as model): $ this- & gt; Renderpartial ('// {model} / _ view', $ ideal); Endforeach;  

Hope that helps.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -