Menu

[r30]: / e9-core / component.class.php  Maximize  Restore  History

Download this file

46 lines (36 with data), 790 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?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";
}
}
}
?>