Skip to content

Instantly share code, notes, and snippets.

@tobsn
Created Dec 16, 2010
Embed
What would you like to do?
blitz template engine view class for slim framework
<?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;
}
}
?>
@codeguy

This comment has been minimized.

Copy link

@codeguy codeguy commented Dec 18, 2010

This has been added to the Slim develop branch. Will be merged into master when 1.1 is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment