Welcome Guest, Not a member yet? Register   Sign In
Template system
#1

[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.
#2

[eluser]Damien K.[/eluser]
You may want to RTFM...
http://ellislab.com/codeigniter/user-guide/
#3

[eluser]vtafsar[/eluser]
I saw template parser guide page, http://ellislab.com/codeigniter/user-gui...arser.html. But there is nothing about conditional structures.
#4

[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.
 
 
 
#5

[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.
#6

[eluser]Colin Williams[/eluser]
Use a more robust template system, like Smarty




Theme © iAndrew 2016 - Forum software by © MyBB