コード例 #1
0
ファイル: template_enc.php プロジェクト: Sajaki/wowroster
 /**
  * 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;
 }
コード例 #2
0
ファイル: template.php プロジェクト: Sajaki/wowroster
 function _tpl_load_file($handle)
 {
     // Try and open template for read
     if (!($fp = fopen($this->files[$handle], 'r'))) {
         trigger_error("template->_tpl_load_file(): File " . $this->files[$handle] . " does not exist or is empty", E_USER_ERROR);
     }
     require_once ROSTER_LIB . 'template_enc.php';
     $this->compiled_code[$handle] = RosterTplEncode::compile(trim(fread($fp, filesize($this->files[$handle]))));
     fclose($fp);
     // Actually compile the code now.
     RosterTplEncode::compile_write($handle, $this->compiled_code[$handle]);
 }