私はcontroller
のコードに以下のコードを書いています。cakephpページ番号付きのページ分割
$this->paginate['Tag'] = array(
'fields' => array('COUNT(tag_id) AS numbers', 'tag', 'slug'),
'limit' => 50,
'order' => 'numbers desc',
'recursive' => 2,
'group' => array('tag'),
);
$tags = $this->paginate('Tag', array('not' => array('site_id' => NULL), 'tag !=' => ''));
.ctp
ファイルに以下のコードを書いてください。
<div class="row section">
<div class="col col_16 pagination">
<h3>Tags</h3>
<?php
foreach ($tags as $key => $tag) {
echo '<span>' . $this->Html->link($tag['Tag']['tag'] . ' (' . $tag[0]['numbers'] . ')', '/tags/' . $tag['Tag']['slug']) . '</span>';
}
?>
</div>
<div class="col col_16 pagination">
<?php
echo $this->Paginator->first('First', null, null, array('class' => 'disabled'));
echo $this->Paginator->prev('Previous', null, null, array('class' => 'disabled'));
echo $this->Paginator->numbers(array('separator' => ''));
echo $this->Paginator->next('Next', null, null, array('class' => 'disabled'));
echo $this->Paginator->last('Last', null, null, array('class' => 'disabled'));
?>
</div>
<div class="col col_16 pagination">
<h5 class="margin0Px">
<?php
echo $this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% out of %count% total, starting on %start%, ending on %end%.', true)
));
?>
</h5>
</div>
</div>
ビュー$this->Paginator
に偽の結果が表示されます。
ここで問題は何ですか?私は何も考えていない。 Plsヘルプ。
.ctpを投稿すると、タグ変数の結果が投稿されることになります.CTPは実際には関係ありません。 (btw、変数を設定しましたか?$ this-> set( 'tags'、$ tags); – Dave
@Daveはい、私はそれを設定しました – gautamlakum