-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #252 from Qchmqs/1.9/develop
added pagination to generated controllers
- Loading branch information
Showing
2 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
$data['<?php echo $plural_name ?>'] = Model_<?php echo $model_name; ?>::find('all'); | ||
$this->template->title = "<?php echo ucfirst($plural_name); ?>"; | ||
$this->template->content = View::forge('<?php echo $view_path; ?>/index', $data); | ||
$query = Model_<?php echo $model_name; ?>::query(); | ||
$pagination = Pagination::forge(array( | ||
'total_items' => $query->count(), | ||
'uri_segment' => 'page', | ||
)); | ||
$data['<?php echo $plural_name ?>'] = $query->rows_offset($pagination->offset) | ||
->rows_limit($pagination->per_page) | ||
->get(); | ||
$this->template->set_global('pagination',$pagination,true); | ||
$this->template->title = "<?php echo ucfirst($plural_name); ?>"; | ||
$this->template->content = View::forge('<?php echo $view_path; ?>/index', $data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
</td> | ||
</tr> | ||
<?php echo '<?php endforeach; ?>'; ?> | ||
<?php echo $pagination;?> | ||
</tbody> | ||
</table> | ||
|
||
|