Skip to content

Instantly share code, notes, and snippets.

@tarnfeld
Created December 24, 2010 17:34
Show Gist options
  • Save tarnfeld/754415 to your computer and use it in GitHub Desktop.
Save tarnfeld/754415 to your computer and use it in GitHub Desktop.
<?php
include 'config.php';
// This should go in your config.php ^^
define('BASEPATH', dirname(__FILE__));
// Also, convention is capitals for constants
define('NAME', "Tom");
function tint($tinty){
$tint_content = file_get_contents(BASEPATH . "pages/" . $tinty . ".txt");
$tint_content = str_replace('<tint:content("', '<?php echo tint_content("', $tint_content);
$tint_content = str_replace('") />', '"); ?>', $tint_content);
echo str_replace("<tint:name />", NAME, $tint_content);
}
function tint_content($tint){
$tint_content = file_get_contents(BASEPATH . "content/".$tint.".txt");
return str_replace("<tint:name />", NAME, $tint_content);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment