cvs: pear /Template Template.php

From: Date: Mon, 14 Jun 2004 07:32:37 +0000
Subject: cvs: pear /Template Template.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-20632@lists.php.net to get a copy of this message
alan_k Mon Jun 14 03:32:37 2004 EDT Modified files: /pear/Template Template.php Log: make all arrays consistant - using _ for long names, "." for seperating Provider specific options http://cvs.php.net/diff.php/pear/Template/Template.php?r1=1.3&r2=1.4&ty=u Index: pear/Template/Template.php diff -u pear/Template/Template.php:1.3 pear/Template/Template.php:1.4 --- pear/Template/Template.php:1.3 Mon Jun 14 03:20:48 2004 +++ pear/Template/Template.php Mon Jun 14 03:32:37 2004 @@ -33,7 +33,7 @@ * See example usage and in-progress documentation at {@link * http://wiki.ciaweb.net/yawiki/index.php?area=Template} * -* $Id: Template.php,v 1.3 2004/06/14 07:20:48 alan_k Exp $ +* $Id: Template.php,v 1.4 2004/06/14 07:32:37 alan_k Exp $ * * @package Template * @@ -92,7 +92,13 @@ /** * - * ??? + * Array of files used by the Template + * some may be with full path, others may just be what the user requested + * + * current_template = full path of the template that is being used. + * requested_template = local path (relative to options['template_dir'] of the template + * being used. + * compiled_template = file to be output (when using compiled templates) * * @access public * @@ -101,9 +107,9 @@ */ var $files = array( - 'currentTemplate' => '', - 'gettextStringsFile' => '', - 'elementsFile' => '', + 'current_template' => '', + 'requested_template' => '', + 'compiled_template' => '', ); @@ -111,19 +117,27 @@ * * Array of various data portions stored in engine. * - * 'variables' => Data assigned to the template by copy. - * - * 'byref' => Data assigned to the template by reference. - * - * 'elements' => ??? - * - * 'object' => ??? + * 'variables' => Data assigned to the template by copy. + * 'byref' => Data assigned to the template by reference. + * 'object' => single object with public variables representing data you want + * overlayed onto the template + * + * + * 'template_src' => the template as a string (used by block/compile from string situations) + * 'template_compiled' => the complied template as a string (when using compiling + * templates to a string) + * + * 'elements' => array of XML_Tree type elements you want to overlay onto the + * template + * 'elements_original' => array of XML_Tree type elements that are in the template + * to be rendered. + * + * Providers have full access to these, + * you have read access to them. + * write access should be carefully considered.. * - * 'elements_original' => ??? - * * @var array - * - * @access private + * @access semi-private * */ @@ -213,16 +227,16 @@ $this->provider['Multisource']->find($file); } else { - $this->files['currentTemplate'] = + $this->files['current_template'] = $this->options['template_dir'][0] . PATH_SEPERATOR . $file; - if (!file_exists($this->files['currentTemplate'])) { - $this->files['currentTemplate'] = false; + if (!file_exists($this->files['current_template'])) { + $this->files['current_template'] = false; } } // cant find the template!!! - if ($this->files['currentTemplate'] === false) { + if ($this->files['current_template'] === false) { // check if the compile dir has been created return $this->raiseError( "Could not find Template {$file} in any of the directories<br>" . @@ -235,7 +249,7 @@ switch($this->options['compiler']) { case '': - $this->files['compiledTemplate'] = $this->files['currentTemplate']; + $this->files['compiledTemplate'] = $this->files['current_template']; $this->debug("Using Raw Compiler"); return true; @@ -266,7 +280,7 @@ function output() { - $this->debug( "output {$this->files['compliedTemplate']}"); + $this->debug( "output {$this->files['compiled_template']}"); if ($this->options['compiler'] == 'block') { echo $this->block('get'); @@ -326,7 +340,7 @@ if (isset($this->data['template_as_string'])) { eval($this->data['template_as_string']); } else { - include $this->files['compiledTemplate']; + include $this->files['compiled_template']; } // Return the error handler to its previous state. @@ -618,10 +632,10 @@ // load the elements if required: if (!isset($this->data['elements_original']) && - $this->files['elementsFile'] &&file_exists($this->files['elementsFile']) ) { + $this->files['elements_file'] &&file_exists($this->files['elements_file']) ) { // maybe more comlexity required? require_once 'HTML/Template/Element.php'; - $this->data['elements_original'] = unserialize(file_get_contents($this->files['elementsFile'])); + $this->data['elements_original'] = unserialize(file_get_contents($this->files['elements_file'])); } if ($name === false) { return $this->data['elements_original'];

« previous php.pear.cvs (#20632) next »