Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

If-Statement in a View #2184

Closed
hice3000 opened this Issue · 3 comments

3 participants

Malte N George Psarakis Andrey Andreev
Malte N

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!
{/if}

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.

George Psarakis

You probably need a Template Library such as http://williamsconcepts.com/ci/codeigniter/libraries/template/reference.html and a template engine such as Smarty .

Malte N

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: https://github.com/Vheissu/Ci-Smarty.

Andrey Andreev
Owner

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

Andrey Andreev 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.