Skip to content


Subversion checkout URL

You can clone with
Download ZIP


If-Statement in a View #2184

hice3000 opened this Issue · 3 comments

3 participants


I am programming a big project now, and I got some problems with the template parser.
I want that there is really no php in my view files, because there are people in my team who dont know it.
The problem is that I have no possibility to create a if-statement.
I want to use somethin like this:

{if " displayName = 'TestUser' "}
You are the user TestUser!

instead of this:

if ($displayName == 'TestUser') {
echo 'You are the user TestUser!';

Would be very happy if something like this will be implemented in the next version of CodeIgniter, or if someone could tell me how to do something like the above example without php.


You probably need a Template Library such as and a template engine such as Smarty .


The project you send me above is outdated, so I tried to get Smarty to work. I found a project which could be very nice when it works, but it doesnt:


There isn't a significant difference:

<? if ($displayName == 'TestUser') { ?>
You are the TestUser!
<? } ?>

Nevertheless, there are plans for the parser to become a driver for different templating systems: #217, #2158

@narfbg narfbg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.