54 public function assign($tpl_var, $value = null, $nocache =
false)
56 if (is_array($tpl_var)) {
57 foreach ($tpl_var as $_key => $_val) {
59 $this->tpl_vars[$_key] =
new Smarty_variable($_val, $nocache);
64 $this->tpl_vars[$tpl_var] =
new Smarty_variable($value, $nocache);
79 public function assignGlobal($varname, $value = null, $nocache =
false)
102 if ($tpl_var !=
'') {
103 $this->tpl_vars[$tpl_var] =
new Smarty_variable(null, $nocache);
104 $this->tpl_vars[$tpl_var]->value = &$value;
119 public function append($tpl_var, $value = null, $merge =
false, $nocache =
false)
121 if (is_array($tpl_var)) {
123 foreach ($tpl_var as $_key => $_val) {
125 if (!isset($this->tpl_vars[$_key])) {
126 $tpl_var_inst = $this->
getVariable($_key, null,
true,
false);
128 $this->tpl_vars[$_key] =
new Smarty_variable(null, $nocache);
130 $this->tpl_vars[$_key] = clone $tpl_var_inst;
133 if (!(is_array($this->tpl_vars[$_key]->value) || $this->tpl_vars[$_key]->value instanceof ArrayAccess)) {
134 settype($this->tpl_vars[$_key]->value,
'array');
136 if ($merge && is_array($_val)) {
137 foreach($_val as $_mkey => $_mval) {
138 $this->tpl_vars[$_key]->value[$_mkey] = $_mval;
141 $this->tpl_vars[$_key]->value[] = $_val;
146 if ($tpl_var !=
'' && isset($value)) {
147 if (!isset($this->tpl_vars[$tpl_var])) {
148 $tpl_var_inst = $this->
getVariable($tpl_var, null,
true,
false);
150 $this->tpl_vars[$tpl_var] =
new Smarty_variable(null, $nocache);
152 $this->tpl_vars[$tpl_var] = clone $tpl_var_inst;
155 if (!(is_array($this->tpl_vars[$tpl_var]->value) || $this->tpl_vars[$tpl_var]->value instanceof ArrayAccess)) {
156 settype($this->tpl_vars[$tpl_var]->value,
'array');
158 if ($merge && is_array($value)) {
159 foreach($value as $_mkey => $_mval) {
160 $this->tpl_vars[$tpl_var]->value[$_mkey] = $_mval;
163 $this->tpl_vars[$tpl_var]->value[] = $value;
181 if ($tpl_var !=
'' && isset($value)) {
182 if (!isset($this->tpl_vars[$tpl_var])) {
183 $this->tpl_vars[$tpl_var] =
new Smarty_variable();
185 if (!is_array($this->tpl_vars[$tpl_var]->value)) {
186 settype($this->tpl_vars[$tpl_var]->value,
'array');
188 if ($merge && is_array($value)) {
189 foreach($value as $_key => $_val) {
190 $this->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key];
193 $this->tpl_vars[$tpl_var]->value[] = &$value;
208 public function getTemplateVars($varname = null, $_ptr = null, $search_parents =
true)
210 if (isset($varname)) {
211 $_var = $this->
getVariable($varname, $_ptr, $search_parents,
false);
212 if (is_object($_var)) {
219 if ($_ptr === null) {
221 }
while ($_ptr !== null) {
222 foreach ($_ptr->tpl_vars AS $key => $var) {
223 if (!array_key_exists($key, $_result)) {
224 $_result[$key] = $var->value;
228 if ($search_parents) {
229 $_ptr = $_ptr->parent;
236 if (!array_key_exists($key, $_result)) {
237 $_result[$key] = $var->value;
253 if (is_array($tpl_var)) {
254 foreach ($tpl_var as $curr_var) {
255 unset($this->tpl_vars[$curr_var]);
258 unset($this->tpl_vars[$tpl_var]);
270 $this->tpl_vars = array();
285 $config->loadConfigVars($sections);
297 public function getVariable($variable, $_ptr = null, $search_parents =
true, $error_enable =
true)
299 if ($_ptr === null) {
301 }
while ($_ptr !== null) {
302 if (isset($_ptr->tpl_vars[$variable])) {
304 return $_ptr->tpl_vars[$variable];
307 if ($search_parents) {
308 $_ptr = $_ptr->parent;
317 if ($this->smarty->error_unassigned && $error_enable) {
333 while ($_ptr !== null) {
334 if (isset($_ptr->config_vars[$variable])) {
336 return $_ptr->config_vars[$variable];
339 $_ptr = $_ptr->parent;
341 if ($this->smarty->error_unassigned && $error_enable) {
357 $fp = fopen($variable,
'r+');
359 while (!feof(
$fp) && ($current_line = fgets(
$fp)) !==
false ) {
360 $_result .= $current_line;
366 if ($this->smarty->error_unassigned) {
367 throw new SmartyException(
'Undefined stream variable "' . $variable .
'"');
382 $var_array = array();
383 while ($_ptr !== null) {
384 if (isset($varname)) {
385 if (isset($_ptr->config_vars[$varname])) {
386 return $_ptr->config_vars[$varname];
389 $var_array = array_merge($_ptr->config_vars, $var_array);
392 if ($search_parents) {
393 $_ptr = $_ptr->parent;
398 if (isset($varname)) {
413 if (isset($varname)) {
414 unset($this->config_vars[$varname]);
416 $this->config_vars = array();
449 if (is_object($_parent)) {
451 $this->parent = $_parent;
452 }
elseif (is_array($_parent)) {
454 foreach ($_parent as $_key => $_val) {
455 $this->tpl_vars[$_key] =
new Smarty_variable($_val);
457 }
elseif ($_parent != null) {
537 if ($name ==
'nocache') {
appendByRef($tpl_var, &$value, $merge=false)
appends values to template variables by reference
append($tpl_var, $value=null, $merge=false, $nocache=false)
appends values to template variables
assignByRef($tpl_var, &$value, $nocache=false)
assigns values to template variables by reference
__get($name)
Returns FALSE for 'nocache' and NULL otherwise.
getStreamVariable($variable)
gets a stream variable
assignGlobal($varname, $value=null, $nocache=false)
assigns a global Smarty variable
__construct($value=null, $nocache=false, $scope=Smarty::SCOPE_LOCAL)
create Smarty variable object
clearAssign($tpl_var)
clear the given assigned template variable.
static $global_tpl_vars
#@-
__toString()
Always returns an empty string.
getVariable($variable, $_ptr=null, $search_parents=true, $error_enable=true)
gets the object of a Smarty variable
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
getConfigVariable($variable, $error_enable=true)
gets a config variable
__toString()
<> String conversion
clearConfig($varname=null)
Deassigns a single or all config variables.
const SCOPE_LOCAL
define variable scopes
configLoad($config_file, $sections=null)
load a config file, optionally load just selected sections
__construct($_parent=null, $smarty=null)
create Smarty data object
clearAllAssign()
clear all the assigned template variables.
assign($tpl_var, $value=null, $nocache=false)
assigns a Smarty variable
getTemplateVars($varname=null, $_ptr=null, $search_parents=true)
Returns a single or all template variables.
getConfigVars($varname=null, $search_parents=true)
Returns a single or all config variables.