/** * 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; }
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]); }