CI_Parser - allows variables and PHP code? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: CI_Parser - allows variables and PHP code? (/showthread.php?tid=51372) |
CI_Parser - allows variables and PHP code? - El Forum - 05-01-2012 [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) 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. CI_Parser - allows variables and PHP code? - El Forum - 05-01-2012 [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. |