这是我的小事,我想在页面上显示数据库中的数据,显示时无需担心,但是我希望从第二次出现时开始显示此数据。会有人知道怎么做吗? 我在下面放置了我的控制器文件和ctp文件。 先感谢您 我指定我是新手,没有cakephp 我的控制器文件:
class ArticlesController extends AppController {
public function index(){
$this->paginate = array('all',
'conditions' => array('Article.statu' => '1'),
'limit' => 4,
'order' => array('Article.id' => 'desc')
);
$this->set('articles', $this->paginate('Article'));
}
}
我的index.ctp:
<?php
$paginator = $this->Paginator;
foreach ($articles as $article){
echo'
<div class="single-blog-post featured-post mb-30">
<div class="post-thumb">';
echo $this->Html->image($article['Article']['image'], array('style' => 'height:484px!important;width:1000px!important;', 'url' => array('controller' => 'articles', 'action' => 'detail_article', h($article['Article']['id']))));
echo'</div>';
echo' <div class="post-data">
<a class="post-title one">
<h6>';echo $article['Article']['titre']; echo'</h6></a>';
echo'<div class="post-meta">';
echo'<p class="post-author">Ajouté le '; echo $article['Article']['date'];echo'</p>';
echo' <p>';echo substr($article['Article']['bigresume'],0,400);echo'...</p>';
echo'
</div>
</div>
</div>';
}
?>