CodeIgniter or PHP Equivalent of Rails Partials and Templates

后端 未结 11 1804
猫巷女王i
猫巷女王i 2020-12-30 14:13

In CodeIgniter, or core PHP; is there an equivalent of Rails\'s view partials and templates?

A partial would let me render another view fragment inside my view. I co

11条回答
  •  既然无缘
    2020-12-30 15:00

    I may be breaking some MVC rule, but I've always just placed my "fragments" in individual views and load them, CodeIgniter style, from within the other views that need them. Pretty much all of my views load a header and footer view at the top and bottom, respectively:

    load->view( "header" ); ?>
    //Page content...
    load->view( "footer" ); ?>
    

    The header could then include a NavBar in the same fashion, etc.

提交回复
热议问题