How to Deal With Codeigniter Templates?

前端 未结 12 1866
梦谈多话
梦谈多话 2020-12-08 01:02

I\'m fairly new to MVC, and I\'ve found CodeIgniter recently. I\'m still learning everyday, but one problem is its template engine. What is the best way to create templates

12条回答
  •  北海茫月
    2020-12-08 01:36

    Allow me propose an easier way to do this. Consider my answer to a similar question.

    Pros:

    1. Your template file can be a full HTML file. You don't have to break up the header and the footer.
    2. Any view file can be turned into a template with minimal effort.
    3. Data for the specific view can be generated in the template.

    Cons: 1. You may have to add a template (or layout—if you want to do it the Rails way) directory under views in order to structure your code properly. This follows from Pros[2]. 2. Data for the specific view from the controller must first of all be passed to the template.

提交回复
热议问题