duanchun5520 2011-08-30 05:51 采纳率: 0%
浏览 25
已采纳

CodeIgniter默认布局问题:如何在CodeIgniter_2.0.2中为整个项目创建默认布局?

I want to create a default layout for whole codeigniter project. (like cakephp)

I also need to pass value from database (through controller) to default layout.

How can i do this ?

  • 写回答

4条回答 默认 最新

  • dongmei9508 2011-08-30 06:34
    关注

    You can use the hooks to achieve this

    post_controller - You can set vars with this.
    Called immediately after your controller is fully executed.

    display_override - You can override display and include your own view.
    Overrides the _display() function, used to send the finalized page to the web browser at the end of system execution. This permits you to use your own display methodology. Note that you will need to reference the CI superobject with $this->CI =& get_instance() and then the finalized data will be available by calling $this->CI->output->get_output()

    reference : http://codeigniter.com/user_guide/general/hooks.html

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

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!