Created
December 16, 2010 01:58
-
-
Save tobsn/742905 to your computer and use it in GitHub Desktop.
blitz template engine view class for slim framework
This file contains 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 | |
// extended blitz class for better block handling (load assoc arrays correctly, one level) | |
class xBlitz extends Blitz{function xblock($k,$a){foreach($a as $v){$this->block('/'.$k,$v,true);}}} | |
class BlitzView extends View { | |
private $blitzEnvironment = null; | |
public function render( $template ) { | |
$env = $this->getEnvironment( $template ); | |
return $env->parse( $this->data ); | |
} | |
private function getEnvironment( $template ) { | |
if ( !$this->blitzEnvironment ) { | |
ini_set( 'blitz.path', $this->getTemplatesDirectory().'/' ); | |
$this->blitzEnvironment = new xBlitz( $template ); | |
} | |
return $this->blitzEnvironment; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This has been added to the Slim
develop
branch. Will be merged into master when 1.1 is complete.