![]() |
Parser->Parser_String - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Parser->Parser_String (/showthread.php?tid=25078) |
Parser->Parser_String - El Forum - 11-30-2009 [eluser]tonydewan[/eluser] This is a quicky. I'm sure someone has written this before, but I couldn't find anything in the forums after a few seconds of searching. Basically, I added a parse_string() method to the built in parser. This way, you can take a string of text(like say, from a DB) and parse out the same pseudo-variables. I went ahead and made it default to return a string (rather than appending to output, like the normal parse() method), because that made the most sense to me. This functionality would be welcome in the main library, I think. Here is MY_Parser.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |