dscbxou1900343 2010-02-19 04:30
浏览 82
已采纳

CakePHP布局局部?

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 in views/elements. There you can create a recyclable element.

    Now, on views/layouts/default.ctp

    $this->render('latest-posts');
    

    There you go.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ssh登录页面的问题
  • ¥60 渗透一个指定银行app,拿到客户信息,需要什么级别
  • ¥50 关于在matlab上对曲柄摇杆机构上一点的运动学仿真
  • ¥15 jetson nano
  • ¥15 :app:debugCompileClasspath'.
  • ¥15 windows c++内嵌qt出现数据转换问题。
  • ¥20 公众号如何实现点击超链接后自动发送文字
  • ¥15 用php隐藏类名和增加类名
  • ¥15 算法设计与分析课程的提问
  • ¥15 用MATLAB汇总拟合图