Template system |
[eluser]vtafsar[/eluser]
Hello, Any one familiar with codeigniter template system ? I just want to know how to write a conditional structure on the template Thanks.
[eluser]vtafsar[/eluser]
I saw template parser guide page, http://ellislab.com/codeigniter/user-gui...arser.html. But there is nothing about conditional structures.
[eluser]John_Betong[/eluser]
[quote author="vtafsar" date="1254576713"]I saw template parser guide page, http://ellislab.com/codeigniter/user-gui...arser.html. But there is nothing about conditional structures.[/quote] Perhaps there is nothing in the user guide about conditional structures because it should not be there. As far as I understand MVC then the template is similar to a view. If so then the purpose of a view is to display data. The data is processed (maybe wih a little help from a model) and the data output is then sent to the view.
[eluser]Jondolar[/eluser]
Conditional statements definitely belong in the view (i.e. template). They are view logic, not business logic. Wrap your section of html code with a pseudo-variable such as: {blog_entries} html bla bla bla {/blog_entries} If you do not want the above to display then create your data array with an empty array element called $data['blog_entries'] = array(); This will remove the entry since there are no elements in the array. Good luck with your project.
|
Welcome Guest, Not a member yet? Register Sign In |