14 if (!defined(
'IN_PEEL')) {
18 require dirname(__FILE__) . DIRECTORY_SEPARATOR .
'smarty' . DIRECTORY_SEPARATOR .
'Smarty.class.php';
19 require dirname(__FILE__) . DIRECTORY_SEPARATOR .
'SmartyTemplate.php';
33 public function __construct($templadeDir, $forceCompile =
false, $debugging =
false)
35 $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR .
'smarty' . DIRECTORY_SEPARATOR;
36 $this->smarty =
new Smarty();
37 $this->smarty->setCompileDir($dir .
'compile' . DIRECTORY_SEPARATOR);
38 $this->smarty->setCacheDir($dir .
'cache' . DIRECTORY_SEPARATOR);
39 $this->smarty->setTemplateDir($templadeDir);
41 $this->smarty->compile_check = (bool)$forceCompile;
42 $this->smarty->force_compile =
false;
43 $this->smarty->debugging = (bool)$debugging;
44 $this->smarty->_file_perms =
vb(
$GLOBALS[
'site_parameters'][
'chmod_new_files'], null);
45 $this->smarty->registerPlugin(
"modifier",
"filtre_javascript",
"filtre_javascript");
46 $this->smarty->registerPlugin(
"modifier",
"html_entity_decode_if_needed",
"String::html_entity_decode_if_needed");
47 $this->smarty->registerPlugin(
"modifier",
"str_shorten",
"String::str_shorten");
48 $this->smarty->registerPlugin(
"modifier",
"nl2br_if_needed",
"String::nl2br_if_needed");
49 $this->smarty->registerPlugin(
"modifier",
"str_form_value",
"String::str_form_value");
50 $this->smarty->registerPlugin(
"modifier",
"strtoupper",
"String::strtoupper");
51 $this->smarty->registerPlugin(
"modifier",
"html_entity_decode",
"String::html_entity_decode");
52 $this->smarty->registerPlugin(
"modifier",
"htmlentities",
"String::htmlentities");
53 $this->smarty->registerPlugin(
"modifier",
"textEncode",
"String::textEncode");
54 $this->smarty->registerPlugin(
"modifier",
"highlight_found_text",
"highlight_found_text");
55 $this->smarty->registerDefaultTemplateHandler(
'SmartyDefaultTemplateHandler');
60 $this->smarty->addTemplateDir($templadeDir);
63 public function assign($tpl_var, $value = null)
65 $this->smarty->assign($tpl_var, $value);
70 $this->smarty->display($template);
73 public function fetch($template)
75 return $this->smarty->fetch($template);
83 if(!isset(
$data[
'site_id'])) {
86 if(!isset(
$data[
'wwwroot'])) {
101 $data[
'mail_dir'] = null;
102 $data[
'come_from'] =
vb($_SERVER[
'HTTP_REFERER']);
107 if(!empty($_SESSION[
'session_caddie'])) {
108 $data[
'cart_qties'] = $_SESSION[
'session_caddie']->count_products();
109 $data[
'cart'] = $_SESSION[
'session_caddie']->articles;
111 $data[
'currencies'] = array($_SESSION[
'session_devise'][
'code']);
112 $data[
'id_currency_cookie'] = $_SESSION[
'session_devise'][
'code'];
113 $data[
'logged'] = (!empty($_SESSION[
'session_utilisateur'][
'id_utilisateur']));
114 $data[
'page_name'] = null;
115 $data[
'customerName'] = (!empty($_SESSION[
'session_utilisateur'][
'id_utilisateur'])?
vb($_SESSION[
'session_utilisateur'][
'prenom']) .
' '.
vb($_SESSION[
'session_utilisateur'][
'nom_famille']):null);
116 $data[
'priceDisplay'] = null;
123 if($resource_type ==
'file' ) {
124 return $GLOBALS[
'dirroot'] .
"/modeles/peel7/smarty/".$resource_name;
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
addTemplateDir($templadeDir)
SmartyDefaultTemplateHandler($resource_type, $resource_name, &$template_source, &$template_timestamp, Smarty $smarty)
assign($tpl_var, $value=null)
const CACHING_OFF
define caching modes
__construct($templadeDir, $forceCompile=false, $debugging=false)
Smarty plugin to format text blocks.
createTemplate($template, array $data=null)
$GLOBALS['page_columns_count']
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']