Last active
December 12, 2015 03:08
-
-
Save Swader/4703963 to your computer and use it in GitHub Desktop.
CI++ article gist 11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$oParser = new Parser(); | |
// Here we give values to the tags the parser can expect in the content. | |
$aTagValues = array( | |
'name' => 'Bruno', | |
'title' => 'M.A.' | |
); | |
$sContent = "Dear {{title}} {{name}}, we are spamming you to sell you canned beans."; | |
// Parsing by return value. | |
$sContent = $oParser->doParse($aTagValues, $sContent); | |
// You can also parse by reference and chain the | |
// Parser (doParseRef returns the Parser instance), | |
// but be careful - the original string is then modified | |
// $oParser->doParseRef($aTagValues, $sContent); | |
die($sContent); //Produces. "Dear M.A. Bruno, we are spamming you to sell you canned beans." | |
?> |
Author
Swader
commented
Feb 3, 2013
https://gist.github.com/4703963
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment