Welcome Guest, Not a member yet? Register   Sign In
CI_Parser - allows variables and PHP code?
#1

[eluser]Unknown[/eluser]
When I read the code for the CI_Parser class, the main function reads as follows:

Code:
public function parse($template, $data, $return = FALSE)
{
$CI =& get_instance();
$template = $CI->load->view($template, $data, TRUE);
return $this->_parse($template, $data, $return);
}

Why does the template parser first allow PHP output (making the variables available to PHP) and <i>then</i> parse the result, replacing the {simple_style} variables with the passed values?

This logic looks... well, very needlessly complex.
#2

[eluser]Aken[/eluser]
That's because the template parser is a very simple solution, not meant to be a full-blown template solution. It allows some flexibility in that it will both parse a view file like normal and allow the curly brace tags to be replaced. Read the user guide page for it - it explains this a little.




Theme © iAndrew 2016 - Forum software by © MyBB