Exemplo n.º 1
0
 /**
  * Generates a reference to the given variable inside the given (possibly nested)
  * block namespace. This is a string of the form:
  * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
  * It's ready to be inserted into an "echo" line in one of the templates.
  * NOTE: expects a trailing "." on the namespace.
  */
 function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
 {
     # Strip the trailing period.
     $namespace = substr($namespace, 0, strlen($namespace) - 1);
     # Get a reference to the data block for this namespace.
     $varref = RosterTplEncode::generate_block_data_ref($namespace, true, $defop);
     # Append the variable reference.
     $varref .= "['{$varname}']";
     return $echo ? "<?php echo {$varref}; ?>" : $varref;
 }