Template Parser & Associated Questions |
[eluser]sophistry[/eluser]
"Smarty was a friend of mine. CI Template Parser, you are no Smarty." - WRT, Sen. Althouse don't make the mistake thinking CI Template Parser is like Smarty; it's not. i've used both and now i just use PHP native template style. it's pretty easy - it's even easy to explain. if you use short tags, and you get all of PHP should you need it. with Smarty I was always twisting myself up in smarty-syntax, with the template parser, i was always "prepping" things to get them perfectly arranged in the controller. here's a rundown of "PHP native template" (copied from this old post http://ellislab.com/forums/viewthread/102566/#517530: ------------------------------- just turn on short tags and tell the client you found a good template parser. i wrote the documentation for you below. :-) the syntax is very simple (and supports what you want - if and foreach)): <? to start template tag, ?> to end template tag, to display template variable use echo keyword, example: <? echo $variable ?> <? if($variable_to_test): ?> to start conditional, <? endif; ?> to end conditional, example: <? if($is_true): ?> <? foreach($list as $item): ?> to start loop, <? echo $item ?> inside loop <? endforeach; ?> to end loop in the controller...(developer will edit this) Code: function template() Code: <html> EDIT: you could even do it with short tags Code: <html> |
Messages In This Thread |
Template Parser & Associated Questions - by El Forum - 10-01-2009, 03:42 AM
Template Parser & Associated Questions - by El Forum - 10-01-2009, 04:11 AM
Template Parser & Associated Questions - by El Forum - 10-01-2009, 10:45 AM
Template Parser & Associated Questions - by El Forum - 10-02-2009, 01:03 AM
Template Parser & Associated Questions - by El Forum - 10-02-2009, 08:35 AM
Template Parser & Associated Questions - by El Forum - 10-02-2009, 03:11 PM
|