X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/2c915a3f4d69c5c4d28064cf5e4a7b5b3dbc6d75..6bf4de0f31dae411c28ce677b6982a17d7892795:/lib/MLIB/Tpl.php diff --git a/lib/MLIB/Tpl.php b/lib/MLIB/Tpl.php index 853d43a..e0c3c39 100644 --- a/lib/MLIB/Tpl.php +++ b/lib/MLIB/Tpl.php @@ -18,95 +18,95 @@ You should have received a copy of the GNU Lesser General Public License; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -Creado: jue jul 29 09:42:56 ART 2004 -Autor: Martín Marrese - m_marrese@argentina.com +Created: jue jul 29 09:42:56 ART 2004 +Authors: Martín Marrese + Leandro Lucarella ------------------------------------------------------------------------------- $Id$ -----------------------------------------------------------------------------*/ /** - * Clase dummy / interfaz para los templates de mlib. - * Establece los parametros para el contructor y los parametros del metodo - * parse. + * Templates interface for mlib. + * This interface define the basic behavoir of all the template implementations + * in mlib. It has 4 method which are the only ones you should use when drawing + * your components. + * + * @todo Add a global example using all the methods. + * @author Leandro Lucarella + * @author Martín Marrese + * @since 1.0 */ -class MLIB_Tpl { +class /* interface */ MLIB_Tpl { /** - * Constructor. Backward compatibility ( < PHP5 ). - * - * @param string $root Root directory where template files are. - * @param bool $useIncludePath If it's true, it looks for template files in - * PHP's include_path. - * @param string $group Group of templates to use (a subdirectory in root). + * Returns a parsed template. + * This function parses a template $name in the $group (or the current group + * if it's null), replacing the variables specified by $vars. $vars can be a + * string (in which case it's replaced by the value $val) or an asociative + * array, where the keys are the variables to replace and the values are the + * text to put in the place of the variable. * - * @access public - * @return void + * @param string $name Name of template to parse. + * @param mixed $vars Variables to replace in the template. + * @param string $val If $vars is a string, the value to replace + * for $vars. + * + * @return The parsed template $name (in $group) with its $vars replaced. + * @todo Add an example. */ - function MLIB_Tpl($root = '.', $useIncludePath = false, $group = '') + function parse($name, $vars = '', $val = '', $group = null) { - //Aca no sabia si hacer - //$this->__construct($root, $useIncludePath, $group); - trigger_error('Not implemented!', E_USER_WARNING); + trigger_error('Not implemented!', E_USER_ERROR); } /** - * Constructor. (PHP5) - * - * @param string $root Root directory where template files are. - * @param bool $useIncludePath If it's true, it looks for template files in - * PHP's include_path. - * @param string $group Group of templates to use (a subdirectory in root). + * Sets the group to use and add it to the groups stack. * - * @access public - * @return void + * @param group Group to use (and add to the groups stack). + * @todo Add an example. */ - function __construct($root = '.', $useIncludePath = false, $group = '') + function pushGroup($group = '') { - trigger_error('Not implemented!', E_USER_WARNING); + trigger_error('Not implemented!', E_USER_ERROR); } /** - * Returns a parsed template. - * - * @param string $name Name of template to parse. - * @param mixed $vars Variables to replace in the template. - * @param string $val If $vars is a string, the value to replace - * for $vars. - * @param mixed $group Group to use to parse this template. - * null to use the current group. + * Removes the current group from the groups stack and returns it. * - * @access public - * @return mixed + * @return Last used group. + * @todo Add an example. */ - function parse($name, $vars = '', $val = '', $group = null) - { - trigger_error('Not implemented!', E_USER_WARNING); + function popGroup() { + trigger_error('Not implemented!', E_USER_ERROR); } /** - * Returns the template file name based on the blockname - * - * @param string $block BlockName. + * Returns the current group from the groups stack. * - * @access public - * @return mixed + * @return Current group. + * @todo Add an example. */ - function getFileName($block) + function getGroup() { - trigger_error('Not implemented!', E_USER_WARNING); + return end($this->group); } /** - * Returns the template file content. + * Tells if a template exists. + * True if the template $name exists in $group (or the current group if + * $group is null) * - * @param string $file Filename. + * @param name Name of the template. + * @param group Template's group. If it's null it uses the current group. * - * @access public - * @return mixed + * @return true if template $name exists in $group, false if not. + * @todo Add an example. */ - function getFileContent($filename) + function exists($name, $group = null) { - trigger_error('Not implemented!', E_USER_WARNING); + trigger_error('Not implemented!', E_USER_ERROR); } + } + ?> \ No newline at end of file