apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: HTML_Template_Flexy

Source Location: /HTML_Template_Flexy-0.7/Flexy.php

Class Overview


A Flexible Template engine - based on simpletemplate


Author(s):

Version:

  • $Id: Flexy.php,v 1.61 2004/04/03 03:02:30 alan_k Exp $

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 62]
A Flexible Template engine - based on simpletemplate
  • Version: $Id: Flexy.php,v 1.61 2004/04/03 03:02:30 alan_k Exp $
  • Abstract:

    Long Description Have a look at the package description for details.

    usage: $template = new HTML_Template_Flexy($options); $template->compiler('/name/of/template.html'); $data =new StdClass $data->text = 'xxxx'; $template->outputObject($data,$elements)

    Notes: $options can be blank if so, it is read from PEAR::getStaticProperty('HTML_Template_Flexy','options');

    the first argument to outputObject is an object (which could even be an associateve array cast to an object) - I normally send it the controller class. the seconde argument '$elements' is an array of HTML_Template_Flexy_Elements eg. array('name'=> new HTML_Template_Flexy_Element('',array('value'=>'fred blogs'));



[ Top ]


Class Variables

$compiledTemplate =

[line 119]

The compiled template filename (Full path)
  • Access: public

Type:   string


[ Top ]

$currentTemplate =

[line 128]

The source template filename (Full path)
  • Access: public

Type:   string


[ Top ]

$elementsFile =

[line 143]

The serialized elements array file.
  • Access: public

Type:   string


[ Top ]

$emailBoundary =

[line 105]

emailBoundary - to use put {this.emailBoundary} in template
  • Access: public

Type:   string


[ Top ]

$emaildate =

[line 112]

emaildate - to use put {this.emaildate} in template
  • Access: public

Type:   string


[ Top ]

$gettextStringsFile =

[line 136]

The getTextStrings Filename
  • Access: public

Type:   string


[ Top ]

$options = array(   'compileDir'    =>  '',         // where do you want to write to..
                            'templateDir'   =>  '',         // where are your templates
                            'locale'        => 'en',        // works with gettext or File_Gettext
                            'textdomain'    => '',          // for gettext emulation with File_Gettext
                                                            // eg. 'messages' (or you can use the template name.
                            'textdomainDir' => '',          // eg. /var/www/site.com/locale
                                                            // so the french po file is:
                                                            // /var/www/site.com/local/fr/LC_MESSAGE/{textdomain}.po
                                                            
                            'forceCompile'  =>  false,      // only suggested for debugging

                            'debug'         => false,       // prints a few messages
                            
                            'nonHTML'       => false,       // dont parse HTML tags (eg. email templates)
                            'allowPHP'      => false,       // allow PHP in template
                            'compiler'      => 'Standard',  // which compiler to use.
                            'compileToString' => false,     // should the compiler return a string 
                                                            // rather than writing to a file.
                            'filters'       => array(),// used by regex compiler.
'numberFormat'=>",2,'.',','",// default number format  = eg. 1,200.00
'flexyIgnore'=>0,// turn on/off the tag to element code
'strict'=>false,// All elements in the template must be defined !
'multiSource'=>false,// Allow same template to exist in multiple places
// So you can have user themes....
'templateDirOrder'=>'',// set to 'reverse' to assume that first template
// is the one use, rather than last (default)
)

[line 68]


Type:   mixed


[ Top ]



Method Detail

HTML_Template_Flexy (Constructor)   [line 168]

HTML_Template_Flexy HTML_Template_Flexy( [array $options = array()])

Constructor

Initializes the Template engine, for each instance, accepts options or reads from PEAR::getStaticProperty('HTML_Template_Flexy','options');

  • Access: public

Parameters:

array   $options   —  (Optional)

[ Top ]

bufferedOutputObject   [line 285]

string bufferedOutputObject( object object &$t, [ $elements = array()])

Outputs an object as $t, buffers the result and returns it.

See outputObject($t) for more details.

  • Return: - result
  • Author: Alan Knowles
  • Version: 01/12/14
  • Access: public

Parameters:

object object   &$t   —  to output as $t
   $elements   — 

[ Top ]

compile   [line 325]

boolean compile( string $file, boolean $fixForMail)

compile the template
  • Return: true on success. false on failure..
  • Author: Wolfram Kriesing <wolfram@kriesing.de>
  • Version: 01/12/03
  • Access: public

Parameters:

string   $file   —  relative to the 'templateDir' which you set when calling the constructor
boolean   $fixForMail   —  - replace ?>\n with ?>\n\n

[ Top ]

compileAll   [line 470]

void compileAll( [ $dir = ''], [ $regex = '/.html$/'])

compiles all templates Used for offline batch compilation (eg. if your server doesn't have write access to the filesystem).

Parameters:

   $dir   — 
   $regex   — 

[ Top ]

debug   [line 527]

none debug( string $string)

if debugging is on, print the debug info to the screen

Parameters:

string   $string   —  output to display

[ Top ]

getElements   [line 610]

array getElements( )

Get an array of elements from the template

All <form> elements (eg. <input><textarea) etc.) and anything marked as dynamic (eg. flexy:dynamic="yes") are converted in to elements (simliar to XML_Tree_Node) you can use this to build the default $elements array that is used by outputObject() - or just create them and they will be overlayed when you run outputObject()

  • Return: of HTML_Template_Flexy_Element sDescription
  • Access: public

[ Top ]

mergeElement   [line 548]

HTML_Template_Flexy_Element mergeElement( HTML_Template_Flexy_Element $original, HTML_Template_Flexy_Element $new)

A general Utility method that merges HTML_Template_Flexy_Elements Static method - no native debug avaiable..
  • Return: the combined/merged data.
  • Access: public

Parameters:

HTML_Template_Flexy_Element   $original   —  (eg. from getElements())
HTML_Template_Flexy_Element   $new   —  (with data to replace/merge)

[ Top ]

outputObject   [line 209]

none outputObject( object to &$t, [array $elements = array()])

Outputs an object as $t

for example the using simpletags the object's variable $t->test would map to {test}

  • Author: Alan Knowles
  • Version: 01/12/14
  • Access: public

Parameters:

object to   &$t   —  output
array   $elements   —  HTML_Template_Flexy_Elements (or any object that implements toHtml())

[ Top ]

staticQuickTemplate   [line 305]

string &staticQuickTemplate( object object $file, filename &$t)

static version which does new, compile and output all in one go.

See outputObject($t) for more details.

  • Return: - result
  • Author: Alan Knowles
  • Version: 01/12/14
  • Access: public

Parameters:

object object   $file   —  to output as $t
filename   &$t   —  of template

[ Top ]


Documentation generated on Mon, 11 Mar 2019 10:14:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.