<?php
class e_component
{
protected $name, $params, $out, $extension;
function __construct( $array )
{
global $_var;
$this->name = $array['name'];
$this->params = $array;
$this->extension = &$_var['extensions'][ $_var['components'][$this->name] ];
}
function render()
{
$ret = $this->fetch( 'template.html' );
return $ret;
}
function fetch( $str )
{
global $_dir, $_out, $_var;
return $_out->fetch( "{$_dir['extensions']}{$_var['components'][$this->name]}/components/{$this->name}/{$str}" );
}
static function smarty_component( $params )
{
$cname = 'comp_' . $params['name'];
if ( class_exists( $cname ) )
{
$c = new $cname( $params );
return $c->render();
}
else
{
return "{$params['name']}: missing component";
}
}
}
?>