![]() |
Dynamic code in view variables - 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: Dynamic code in view variables (/showthread.php?tid=46915) |
Dynamic code in view variables - El Forum - 11-20-2011 [eluser]Unknown[/eluser] I'm trying to figure out how best to tackle parsing variable code. Essentially I want to do something like this: Controller: Code: $data = array(); View message.php: Code: <html> BUT to have $content parsed as if it were another view file; ie processing php loops, conditionals and perhaps other CI code. I guess it's similar to $this->parser->parse_string($content) the CI templating class, but I need to handle things like nested conditionals as well as the simple loops it offers. My only guess at the moment is to dynamically create view files and load them within the main message.php view... but it's not very attractive :| Maybe extending the core loader class? But ideally something simpler! |