Skip to content

Instantly share code, notes, and snippets.

@Swader
Last active December 12, 2015 03:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Swader/4703963 to your computer and use it in GitHub Desktop.
Save Swader/4703963 to your computer and use it in GitHub Desktop.
CI++ article gist 11
<?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."
?>
@Swader
Copy link
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