Skip to content

Instantly share code, notes, and snippets.

@kurtpayne
Created July 2, 2012 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurtpayne/ec35af03594246c6dd52 to your computer and use it in GitHub Desktop.
Save kurtpayne/ec35af03594246c6dd52 to your computer and use it in GitHub Desktop.
Override prepareTemplate
<?php
/**
* Define constants after requires/includes
* @param Text_Template $template
* @return void
*/
public function prepareTemplate( Text_Template $template ) {
$property = new ReflectionProperty( $template, 'template' );
$property->setAccessible( true );
$str = $property->getValue( $template );
$str = str_replace( '{constants}', '', $str );
$str .= "\n{constants}\n";
$property->setValue( $template, $str );
parent::prepareTemplate( $template );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment