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

Class: KTemplateAbstract

Source Location: /libraries/koowa/template/abstract.php

Class Overview

KObject
   |
   --KTemplateAbstract

Abstract Template class


Author(s):

Variables

Methods


Child classes:

Abstract Template
KTemplateDefault
Default Template class

Inherited Variables

Inherited Methods

Class: KObject

KObject::__construct()
Constructor
KObject::get()
Get the object properties
KObject::getHandle()
Get a handle for this object
KObject::getIdentifier()
Gets the service identifier.
KObject::getMethods()
Get a list of all the available methods
KObject::getService()
Get an instance of a class based on a class identifier only creating it if it does not exist yet.
KObject::inherits()
Checks if the object or one of it's mixin's inherits from a class.
KObject::mixin()
Mixin an object
KObject::set()
Set the object properties
KObject::_initialize()
Initializes the options for the object
KObject::__call()
Search the mixin method map and call the method or trigger an error
KObject::__clone()
Preform a deep clone of the object.

Class Details

[line 16]
Abstract Template class



Tags:

author:  Johan Janssens <johan@nooku.org>
abstract:  


[ Top ]


Class Variables

static $_errors = array(
        1     => 'Fatal Error',
        2     => 'Warning',
        4     => 'Parse Error',
        8     => 'Notice',
        64    => 'Compile Error',
        256   => 'User Error',
        512   => 'User Warning',
        2048  => 'Strict',
        4096  => 'Recoverable Error'
    )

[line 65]

Template errors



Tags:

access:  private

Type:   array


[ Top ]

$_contents =  ''

[line 37]

The template contents



Tags:

access:  protected

Type:   string


[ Top ]

$_data = array()

[line 30]

The template data



Tags:

access:  protected

Type:   array


[ Top ]

$_filters = array()

[line 44]

The set of template filters for templates



Tags:

access:  protected

Type:   array


[ Top ]

$_path =

[line 23]

The template path



Tags:

access:  protected

Type:   string


[ Top ]

$_stack =

[line 58]

The template stack object



Tags:

access:  protected

Type:   KTemplateStack


[ Top ]

$_view =

[line 51]

View object or identifier (com://APP/COMPONENT.view.NAME.FORMAT)



Tags:

access:  protected

Type:   string|object


[ Top ]



Class Methods


constructor __construct [line 84]

KTemplateAbstract __construct( $config)

Constructor

Prevent creating instances of this class by making the contructor private




Tags:

access:  public


Overridden in child classes as:

ComDefaultTemplateAbstract::__construct()
Constructor

Overrides KObject::__construct() (Constructor)

Parameters:

object An   $config   optional KConfig object with configuration options

[ Top ]

method addFilter [line 357]

KTemplate addFilter( array $filters)

Adds one or more filters for template transformation



Tags:

access:  public


Parameters:

array   $filters   Array of one or more behaviors to add.

[ Top ]

method findFile [line 413]

mixed findFile( string $file)

Searches for the file



Tags:

return:  The full path and file name for the target file, or FALSE if the file is not found
access:  public


Overridden in child classes as:

ComDefaultTemplateAbstract::findFile()
Searches for the file

Parameters:

string   $file   The file path to look for.

[ Top ]

method getData [line 163]

mixed getData( )

Get the template data



Tags:

access:  public


[ Top ]

method getFilter [line 382]

KTemplateFilterInterface getFilter( $filter)

Get a filter by identifier



Tags:

access:  public


Parameters:

   $filter  

[ Top ]

method getHelper [line 471]

KTemplateHelperInterface getHelper( mixed $helper, [array $config = array()])

Get a template helper



Tags:

access:  public


Parameters:

mixed   $helper   KServiceIdentifierInterface
array   $config   An optional associative array of configuration settings

[ Top ]

method getPath [line 153]

string getPath( )

Get the template path



Tags:

access:  public


[ Top ]

method getStack [line 173]

KTemplateStack getStack( )

Get the template object stack



Tags:

access:  public


[ Top ]

method getView [line 183]

KViewAbstract getView( )

Get the view object attached to the template



Tags:

access:  public


[ Top ]

method handleError [line 498]

bool handleError( $code, $message, [ $file = ''], [ $line = 0], [ $context = array()])

Handle template errors



Tags:

access:  public


Parameters:

   $code  
   $message  
   $file  
   $line  
   $context  

[ Top ]

method hasFilter [line 346]

boolean hasFilter( string $filter)

Check if a filter exists



Tags:

return:  TRUE if the filter exists, FALSE otherwise
access:  public


Parameters:

string   $filter   The name of the filter

[ Top ]

method loadFile [line 267]

KTemplateAbstract loadFile( string $file, [array $data = array()], [boolean $process = true])

Load a template by path



Tags:

access:  public


Overridden in child classes as:

ComDefaultTemplateAbstract::loadFile()
Load a template by path -- first look in the templates folder for an override

Parameters:

string   $file   The template path
array   $data   An associative array of data to be extracted in local template scope
boolean   $process   If TRUE process the data using a tmpl stream. Default TRUE.

[ Top ]

method loadIdentifier [line 241]

KTemplateAbstract loadIdentifier( string $template, [array $data = array()], [boolean $process = true])

Load a template by identifier

This functions only accepts full identifiers of the format

  • com:[//application/]component.view.[.path].name




Tags:

access:  public


Parameters:

string   $template   The template identifier
array   $data   An associative array of data to be extracted in local template scope
boolean   $process   If TRUE process the data using a tmpl stream. Default TRUE.

[ Top ]

method loadString [line 289]

KTemplateAbstract loadString( string $string, [array $data = array()], [boolean $process = true])

Load a template from a string



Tags:

access:  public


Parameters:

string   $string   The template contents
array   $data   An associative array of data to be extracted in local template scope
boolean   $process   If TRUE process the data using a tmpl stream. Default TRUE.

[ Top ]

method parse [line 330]

string parse( )

Parse the template

This function passes the template throught read filter chain and returns the result.




Tags:

return:  The parsed data
access:  public


Overridden in child classes as:

ComDefaultTemplateAbstract::parse()
Parse the template

[ Top ]

method render [line 312]

string render( )

Render the template

This function passes the template throught write filter chain and returns the result.




Tags:

return:  The rendered data
access:  public


[ Top ]

method renderHelper [line 448]

string renderHelper( string $identifier, [array $config = array()])

Load a template helper

This functions accepts a partial identifier, in the form of helper.function. If a partial identifier is passed a full identifier will be created using the template identifier.




Tags:

return:  Helper output
access:  public


Parameters:

string   $identifier   Name of the helper, dot separated including the helper function to call
array   $config   An optional associative array of configuration settings

[ Top ]

method setView [line 206]

KControllerAbstract setView( mixed $view)

Method to set a view object attached to the controller



Tags:

throws:  KDatabaseRowsetException If the identifier is not a view identifier
access:  public


Parameters:

mixed   $view   An object that implements KObjectServiceable, KServiceIdentifier object or valid identifier string

[ Top ]

method _initialize [line 135]

void _initialize( $config)

Initializes the options for the object

Called from __construct() as a first step of object instantiation.




Tags:

access:  protected


Overrides KObject::_initialize() (Initializes the options for the object)

Parameters:

object An   $config   optional KConfig object with configuration options.

[ Top ]

method __destroy [line 112]

bool __destroy( )

Destructor

Hanlde sandbox shutdown. Clean all output buffers and display the latest error if an error is found.




Tags:

access:  public


[ Top ]

method __sandbox [line 525]

KTemplateAbstract __sandbox( boolean 0)

Process the template using a simple sandbox

This function passes the template through the read filter chain before letting the PHP parser executed it. The result is buffered.




Tags:

access:  private


Parameters:

boolean   0   If TRUE apply write filters. Default FALSE.

[ Top ]

method __toString [line 549]

string __toString( )

Renders the template and returns the result



Tags:

access:  public


[ Top ]


Documentation generated on Fri, 24 May 2013 03:00:30 +0200 by phpDocumentor 1.4.3