template 
[ doc home ] [ class tree: template ] [ index: template ] [ all elements ]

Class: T24Parser

Source Location: /T24Parser.php

Class Overview

IsterObject
   |
   --IsterParser
      |
      --T24Parser

This class represents a parser for the T24 template language.


Author(s): Ingo Schramm   

Copyright: Copyright (c) 2005 Ister.ORG Ingo Schramm

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterParser

IsterParser::IsterParser()
Constructor

Class: IsterObject

IsterObject::IsterObject()
Constructor
IsterObject::abstractMethodError()
Report attempt to call an abstract method.
IsterObject::addLogger()
Add an IsterLogger to process log messages.
IsterObject::deleteLogger()
Delete an already registered IsterLogger.
IsterObject::getLoggerNames()
Fetch the names of all currently registered IsterLoggers.
IsterObject::getMem()
Return maximum amount of memory an application has allocated at this point.
IsterObject::log()
Trigger a log message.
IsterObject::passPHPmessage()
Catch PHP E_WARNING and E_NOTICE messages.
IsterObject::serialize()
Serialize the object.
IsterObject::setLogLocal()
Set logging local for the current object.
IsterObject::setupLogger()
Setup a logger.
IsterObject::triggerError()
Alias for log();
IsterObject::unserialize()
Unserialize the object.
IsterObject::__sleep()
Executed prior to serialize().
IsterObject::__wakeup()
Executed prior to unserialize().

Class Details

This class represents a parser for the T24 template language.

For a description of buildin functions see T24FunctionContainer.

  1. <html>
  2. <head>
  3. <title><?t24 TITLE ?></title>
  4. </head>
  5. <body>
  6. <h1><?t24 TITLE ?></h1>
  7. </body>
  8. </html>
  9. ---
  10. require_once('IsterTemplate.php');
  11. require_once('IsterTemplateFactory.php');
  12.  
  13. $t = new IsterTemplate( new IsterTemplateFactory );
  14. $t->setLanguage('t24');
  15. $t->setProperty('/template', array('TITLE', 'Test Template');
  16. $t->parse('file.tmpl');
  17. print $t->toString();
  18. ---
  19. <html>
  20. <head>
  21. <title>Test Template</title>
  22. </head>
  23. <body>
  24. <h1>Test Template</h1>
  25. </body>
  26. </html>


copyright:  Copyright (c) 2005 Ister.ORG Ingo Schramm
author:  Ingo Schramm
see:  T24FunctionContainer


[ Top ]


Class Methods


constructor T24Parser

T24Parser T24Parser( [object T24FunctionContainer $level = 0])

Constructor

Parameters:


[ Top ]

method destroy

boolean destroy( )

Explicitly run garbage collection.

[ Top ]

method getChild

object T24Parser &getChild( array $set)

Get a child parser of this parser object.

Will return an object without any source but with all properties cloned. The parent name of child is set to the name of the cloning parser.


Parameters:

array   $set   variable value pairs to define for the new parser

[ Top ]

method getIncluded

array getIncluded( )

Get array of all properties set with parserSetProperty().

[ Top ]

method getName

string getName( )

Get the name of the current source.

[ Top ]

method getParseResult

array getParseResult( )

Get the result of the parser run before execution of the result.

Useful for caching.


[ Top ]

method getProperties

array getProperties( )

Get array with names of included sources.

[ Top ]

method parseFile

boolean parseFile( string $source)

Parse the given source.

Parameters:

string   $source  

[ Top ]

method parserSetProperty

boolean parserSetProperty( string $path, array $array)

Set properties of the parser.

Recognized paths:

  1. // pass array of variables and values to fill the template
  2. '/template', array('var1' => $val1,
  3. 'var2 => $val2,
  4. [...]
  5. )
  6.  
  7. // setup the parser
  8. '/parser', array('include_path', '.', //include path of template files
  9. 'function_separator', ':', //identify buildin functions
  10. 'tag_open', '<?t24', //open a template tag
  11. 'tag_close', '?>' //close a template tag
  12. 'comment_open', '<!--', //for commenting unregistered
  13. 'comment_close', '-->', //for commenting unregistered
  14. 'policy_unregistered',t24SKIP //how to treat unregistered vars
  15. )
  16. // register callback methods
  17. '/register/method', array('method' => &$object)
  18. '/register/alias', array('method' => 'alias')

Possible values for 'policy_unregistered':

  • t24WARN - trigger a warning
  • t24SKIP - skip silently
  • t24KEEP - keep the variable as written in template
  • t24COMMENT - comment the variable out using 'comment_open' and 'comment_close'

Note: A callback method will receive one single array of parameters.


Parameters:

string   $path  
array   $array  

[ Top ]

method parseString

boolean parseString( string $source, [string $name = ''])

Parse the given source.

Parameters:

string   $source  
string   $name  

[ Top ]

method setContainer

boolean setContainer( object T24FunctionContainer &$fcontainer, object T24IncludeTree &$inctree)

Set required objects to initialize this.

Parameters:

object T24FunctionContainer   &$fcontainer  
object T24IncludeTree   &$inctree  

[ Top ]

method setParent

boolean setParent( string $parent)

Set the name of the parent for cild parsers.

Parameters:

string   $parent  

[ Top ]

method setParseResult

boolean setParseResult( array $result)

Set the result of a previous parser run as the current result.

Useful for caching.


Parameters:

array   $result  

[ Top ]

method toString

string toString( )

Return the string representation of the current state of the template.

[ Top ]


Documentation generated on Tue, 20 Dec 2005 11:22:04 +0100 by phpDocumentor 1.3.0RC4