Menu

[r13]: / e9-core / frontend.class.php  Maximize  Restore  History

Download this file

81 lines (63 with data), 1.8 kB

 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
require_once( $_dir['smarty'].'Smarty.class.php' );
require_once( $_dir['theme'].'theme.php' );
class e_frontend extends Smarty
{
function __construct()
{
global $_href;
global $_dir;
global $_site;
global $_url;
global $_theme;
global $_var;
global $_lang;
global $_checkout;
$this->Smarty();
$this->template_dir = $_dir['theme'];
$this->compile_dir = $_dir['tmp'].'/tpl/';
$this->force_compile = true;
$this->request_use_auto_globals = true;
$this->use_sub_dirs = false;
$this->assign( 'app_name', 'Frontend' );
// Assign variables
$this->assign_by_ref( '_href', $_href );
$this->assign_by_ref( '_dir', $_dir );
$this->assign_by_ref( '_url', $_url );
$this->assign_by_ref( '_site', $_site );
$this->assign_by_ref( '_var', $_var );
// Register functions
$this->register_function( 'component', 'e_component::smarty_component', false );
$this->register_function( 'str', 'smarty_str', false );
$this->register_block( 'box', 'smarty_box', false );
$this->register_resource( 'var', array( 'get_template', 'get_timestamp', 'get_secure', 'get_trusted' ) );
}
function render( &$page )
{
global $_var;
$_var['subtemplate'] = $page->get_subtemplate();
$this->display( $page->get_template() . '.html' );
}
}
// Registering new smarty template resource
function get_template($tpl_name, &$tpl_source, &$smarty_obj)
{
global $_var;
$tpl_source = $_var['subtemplate'];
return true;
}
function get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
{
$tpl_timestamp = time();
return true;
}
function get_secure($tpl_name, &$smarty_obj)
{
// assume all templates are secure
return true;
}
function get_trusted($tpl_name, &$smarty_obj)
{
// not used for templates
}
?>