Welcome Guest, Not a member yet? Register   Sign In
Using <!--- ---> instead of <?php ?> in view files
#11

[eluser]Dready[/eluser]
About the built-in parser and conditonnal statements : in fact you can do it, but in your controller. Here is the trick : let's imagine you have this template :
Code:
Hello {username}
{if_logged}You are logged in{/if_logged}

And in your controller :

Code:
$tpl = array('username'=>$this->user->name, 'if_logged' => array());
if ( $this->user->name != 'Anonymous' ) {
  $tpl['if_logged'][] = array();
}
$this->parser->parse('myview',$tpl);

The condition check has to be done in the controller through...


Messages In This Thread
Using <!--- ---> instead of <?php ?> in view files - by El Forum - 09-30-2008, 01:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB