Home>

1. View file calls cgridview, clistview calls custom paging method

<?php $this->widget ("zii.widgets.grid.cgridview", array (
 "id" =>"news-grid", "dataprovider" =>$model->search (), "filter" =>$model, "template" =>"{items} {summary} {pager}",  "selectablerows" =>2,  "pager" =>"zpager",  "summarytext" =>"Pages:{pages}/{page} pages",  "columns" =>array (
  array (
   "class" =>"ccheckboxcolumn",   "footer" =>"<button onclink =" deleteall () ">button</button>
      <button onclink="refashall ()">button</button>",   "footerhtmloptions" =>array ("colspan" =>5),   "selectablerows" =>2,  ),  "id",  array ("name" =>"title",    "htmloptions" =>array ("width" =>"20%"),    "value" =>"mb_substr ($data->title, 0,10," utf-8 ")",   ),  array ("name" =>"content",    "htmloptions" =>array ("width" =>"20%"),    "value" =>"mb_substr (strip_tags ($data-&content;content), 0,10," utf-8 ")",   ),  array ("name" =>"type",    "value" =>"news ::model ()->getnewstype ($data-&type;type)",   ),  "user",  array ("name" =>"status",    "value" =>"news ::model ()->getnewsstatus ($data-&stat;status)",    ),  array (
   "class" =>"cbuttoncolumn",   "buttons" =>array (
    "view" =>array ("visible" =>"false"),    //"delete" =>array ("click" =>"true"),   ),  ), ),));

2. Copy the base paging file,Make changes to your own pagination method

framework/web/widgets/pagers/clistpager.php Copy and save the life name to protected/components/zpager.php Modify the class name

framework/web/widgets/pagers/pager.css Copy the corresponding style file to protected/components/css/pager.css

Modify the css loading directory of zpager.php

public static function registercssfile ($url=null)
{
 if ($url === null)
  $url=chtml ::asset (yii ::getpathofalias ("application.components.css.pager"). ". css");
 yii ::app ()->getclientscript ()->registercssfile ($url);
}

3. By modifying the css style file,You can also modify the program that generates the list,To achieve the purpose of modifying the classification.

php
  • Previous Python method to read all directories and files in a directory
  • Next Working principle and usage analysis of srbac permission extension module in Yii