CodeIgniter Forums
IF statement with a template - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: IF statement with a template (/showthread.php?tid=8635)



IF statement with a template - El Forum - 05-25-2008

[eluser]webshark[/eluser]
Hi,

My views are parsed using the CodeIgniter built in template parser and I am displaying a list of items via a loop (data pulled from database):

My views code:

Code:
{found_content}
<li>{title} - {description} - {image} - {id}</li>
{/found_content}

My question can I run an IF statement using the parsed vars, something like
{if $id == 1}
do something here
{else}
do something else
{/if}

from within the view? similar to Smarty?


IF statement with a template - El Forum - 05-25-2008

[eluser]webshark[/eluser]
Found my answer after an extensive search in the forums:
http://ellislab.com/forums/viewthread/68878/#341795

Saved me from using Smarty (I hate it!)


IF statement with a template - El Forum - 08-08-2008

[eluser]The Wizard[/eluser]
ive used smarty in all my other projects,
i think ill use it here too Smile

its cool, why hate it?