Re: Play nice! Re: Savant/Flexy/Foo template engines

From: Date: Thu, 10 Jun 2004 15:33:00 +0000
Subject: Re: Play nice! Re: Savant/Flexy/Foo template engines
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30402@lists.php.net to get a copy of this message
... is still very, very Flexy in my eyes; I don't think it's sufficiently minimalist to act as a base for different systems,
It's not a base - it tries to deliver all systems, minimally.. not
even with the nods to the Jausions interface names. I only got so far in my attempt to strip it down before I realized I couldn't do it. Here's my abortive attempt (sorry, Alan; I think it was Greg who asked me to try this?):
Keep going :)
/** * Universal Template Provider * * Example to be added.. * */ class HTML_Template {
        // no options by default
    var $options = array();
why? = there are 5 specific options that deal with the goal of the class.
    // no files, we're minimal! :-)
    // no HTML elements, we're minimal! :-)
this is not a Vision, it just dumbs down to the point where you are providing an interface, - rather than delivering a solutions..
    /**
    *   open (and optionally compile a template )
    *
    *   @access     public
    *   @param      string  $file   relative to the 'templateDir' which  you set when calling the constructor
    *   @return     boolean true on success. (or string, if  compileToString) PEAR_Error on failure..
    */
    function openTemplate( $file )
    {
the class is template, repeating the word template as martin pointed out was a bit redundant. - that why it got renamed from the original API
        // This whole method is very Flexy-specific, to be extensible  it needs to
        // be significantly stripped down (esp. the multi-lang)
So Savant, or any other engine would not benefit from the ability to do this? - it's off by default anyway..
        // ...
        // the following assumes the need or desire for a compiler,
        // not necessarily the case.
but it never gets this far in default operation????
        /*  minimalize!  maybe no compiler at all!  :-)
what 4 lines is not minimal enough?
        require_once 'HTML/Template/Compiler.php';
        // factory - check if we need to compile!
        $compiler = HTML_Template_Compiler::factory($this);
        if (!is_a($compiler,'HTML_Template_Compiler')) {
            return $compiler;
        }
        return $compiler->compile();
        */
        // PMJ says:  the base class should just return a pointer to  the template.
        // extended classes can do whatever necessary maipulations to  find
        // the template.
There Are no extended classes!!!??? - the only reasons to extend it are to write BC wrappers.. ?
    function output()
    {
            /* $data not passed in here, where's it coming from? probably  just a typo in the params */
yeap should be $this->data..
       
        /* very Flexy, this should be in an extended class:
again - 4 lines - it theoretically could be used by the WACT backend.. it's also disabled by default..
        if ($this->options['output.element_merge'] !== false) {
            // loads elements into data['elementsOriginal']
            if ($this->getElement()) {
                // elements' loaded preumably... as we have some!
                HTML_Template_Element::mergeAllElements($this);
            }
        }
        */
        // we use PHP's error handler to hide errors in the template.
        // use $options['strict'] - if you want to force declaration of
        // all variables in the template
        /*  This should probably be part of OpenTemplate(), which does  the
        find/filter/compile/filter bit for preparing the template:
I missed that bit...
        if (!is_readable($this->files['compiledTemplate'])) {
              return $this->raiseError( "Could not open the template:  <b>'{$this->compiledTemplate}'</b><BR>".
                            "Please check the file permisons on the  directory and file ",
                            HTML_TEMPLATE_FLEXY_ERROR_FILE,  HTML_TEMPLATE_FLEXY_ERROR_DIE);
        }
        */
/me gives up at this point
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.dev (#30402) next »