cakePHPのscaffoldテンプレートをAutoPagerizeする
cakeのscaffoldでフォルトテンプレートを自分のアプリケーションのview/scaffoldsにコピーする。
cp cake/libs/view/scaffolds/index.ctp app/views/scaffolds/
そしてAutoPagerizeのためにautopagerize_page_elementとrel="next"をマークアップする。できあがり。
--- index.ctp (revision 2644)
+++ index.ctp (working copy)
@@ -31,7 +31,7 @@
'format' => 'Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%'
));
?></p>
-<table cellpadding="0" cellspacing="0">
+<table cellpadding="0" cellspacing="0" class="autopagerize_page_element">
<tr>
<?php foreach ($scaffoldFields as $_field):?>
<th><?php echo $paginator->sort($_field);?></th>
@@ -78,7 +78,7 @@
<div class="paging">
<?php echo "\t" . $paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled')) . "\n";?>
| <?php echo $paginator->numbers() . "\n"?>
-<?php echo "\t ". $paginator->next(__('next', true) .' >>', array(), null, array('class'=>'disabled')) . "\n";?>
+<?php echo "\t ". $paginator->next(__('next', true) .' >>', array('rel' => 'next'), null, array('class'=>'disabled')) . "\n";?>
</div>
<div class="actions">
<ul>
About this entry
You’re currently reading “cakePHPのscaffoldテンプレートをAutoPagerizeする,” an entry on ku
- Published:
- 2008.12.05 / 1pm
- Category:
- AutoPagerize, PHP, cakePHP

No comments
Jump to comment form | comments rss [?]