public function actionList($tab = 'new') { $cat = isset($_GET['cat']) ? $_GET['cat'] : ''; $model = new ScriptForm(); $count = $model->getCountAllScripts($cat); if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $limit = 10; $start = ((int) $page - 1) * $limit; $pages = new CPagination($count); $pages->pageSize = $limit; $data = $model->getAllScripts($cat, $start, $limit, $tab); $this->render('list', array('data' => $data, 'pages' => $pages, 'count' => $count, 'cat' => $cat, 'tab' => $tab)); }
/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex($tab = 'new') { // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' //$this->layout='//layouts/mainindex'; $model = new ScriptForm(); $count = $model->getCountAllScripts(''); if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $limit = 10; $start = ((int) $page - 1) * $limit; $pages = new CPagination($count); $pages->pageSize = $limit; $data = $model->getAllScripts('', $start, $limit, $tab); $this->render('index', array('data' => $data, 'pages' => $pages, 'count' => $count, 'tab' => $tab)); }