In my CakePHP application layout I have a section for latest posts that needs to pull from a database. How would I tell it to render a partial so I can pull the latest posts? Sorry if this is a simple question, I just started CakePHP tonight.
2条回答 默认 最新
- doumao8355 2010-02-19 04:43关注
As nickf said, you can use elements. Just create a
latest-posts.ctp
file inviews/elements
. There you can create a recyclable element.Now, on
views/layouts/default.ctp
$this->render('latest-posts');
There you go.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报