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

Class: PhpExt_Template

Source Location: /PhpExt/Template.php

Class PhpExt_Template

Class Overview

Represents an HTML fragment template. Templates can be precompiled for greater performance. For a list of available format functions, see Ext.util.Format.

Usage:

  1.  $t new PhpExt_Template(
  2.   '<div name="{id}">',
  3.       '<span class="{cls}">{name:trim} {value:ellipsis(10)}</span>',
  4.   '</div>'
  5.  );
  6.  echo $t->getJavascript(false't');
  7.  echo $t->append('some-element'array('id'=>'myid''cls'=>'myclass''name'=>'foo''value'=>'bar'))->output();

For more information see this blog post with examples: @link http://php-ext.quimera-solutions.com/examples/?id=/core/templates

Located in /PhpExt/Template.php [line 35]

PhpExt_Object
   |
   --PhpExt_Template

Properties

Methods

[ Top ]
Descendants
Child Class Description
PhpExt_XTemplate A template class that supports advanced functionality like autofilling arrays, conditional processing with basic comparison operators, sub-templates, basic math function support, special built-in template variables, inline code execution and more. XTemplate also provides the templating mechanism built into Ext.DataView.

[ Top ]
Property Summary
mixed   $_html   True to disable format functions (defaults to false)

[ Top ]
Method Summary
static void   from()  
PhpExt_Template   __construct()  
void   append()   Applies the supplied values to the template and appends the new node(s) to el.
void   apply()   Alias for applyTemplate
void   applyTemplate()   Returns an HTML fragment of this template with the specified values applied.
void   compile()   Compiles the template into an internal function, eliminating the RegEx overhead.
void   getJavascript()  
void   insertAfter()   Applies the supplied values to the template and inserts the new node(s) after el.
void   insertBefore()   Applies the supplied values to the template and inserts the new node(s) before el.
void   insertFirst()   Applies the supplied values to the template and inserts the new node(s) as the first child of el.
void   overwrite()   Applies the supplied values to the template and overwrites the content of el with the new node(s).
void   set()   Sets the HTML used as the template and optionally compiles it.

[ Top ]
Properties
mixed   $_html = array() [line 74]

True to disable format functions (defaults to false)

API Tags:
Return:  True to disable format functions (defaults to false)
Access:  protected


[ Top ]
Methods
static method from  [line 87]

  static void from( $element, $config  )

Parameters:
   $element: 
   $config: 

API Tags:
Access:  public


[ Top ]
Constructor __construct  [line 76]

  PhpExt_Template __construct( )


API Tags:
Access:  public


Redefinition of:
PhpExt_Object::__construct()

Redefined in descendants as:

[ Top ]
append  [line 99]

  void append( string $element, array $values, [boolean $returnElement = false]  )

Applies the supplied values to the template and appends the new node(s) to el.

Parameters:
string   $element:  The context element
array   $values:  The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {'foo'=> 'bar'})
boolean   $returnElement:  (optional) true to return a Ext.Element (defaults to false)

API Tags:
Access:  public


[ Top ]
apply  [line 108]

  void apply( )

Alias for applyTemplate


API Tags:
Access:  public


[ Top ]
applyTemplate  [line 118]

  void applyTemplate( array $values  )

Returns an HTML fragment of this template with the specified values applied.

Parameters:
array   $values:  The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {'foo'=> 'bar'})

API Tags:
Access:  public


[ Top ]
compile  [line 127]

  void compile( )

Compiles the template into an internal function, eliminating the RegEx overhead.


API Tags:
Access:  public


[ Top ]
getJavascript  [line 192]

  void getJavascript( [ $lazy = false], [ $varName = null]  )

Parameters:
   $lazy: 
   $varName: 

API Tags:
Access:  public


Redefinition of:
PhpExt_Object::getJavascript()

[ Top ]
insertAfter  [line 139]

  void insertAfter( string $element, array $values, [boolean $returnElement = false]  )

Applies the supplied values to the template and inserts the new node(s) after el.

Parameters:
string   $element:  The context element
array   $values:  The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {'foo'=> 'bar'})
boolean   $returnElement:  (optional) true to return a Ext.Element (defaults to false)

API Tags:
Access:  public


[ Top ]
insertBefore  [line 151]

  void insertBefore( string $element, array $values, [boolean $returnElement = false]  )

Applies the supplied values to the template and inserts the new node(s) before el.

Parameters:
string   $element:  The context element
array   $values:  The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {'foo'=> 'bar'})
boolean   $returnElement:  (optional) true to return a Ext.Element (defaults to false)

API Tags:
Access:  public


[ Top ]
insertFirst  [line 163]

  void insertFirst( string $element, array $values, [boolean $returnElement = false]  )

Applies the supplied values to the template and inserts the new node(s) as the first child of el.

Parameters:
string   $element:  The context element
array   $values:  The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {'foo'=> 'bar'})
boolean   $returnElement:  (optional) true to return a Ext.Element (defaults to false)

API Tags:
Access:  public


[ Top ]
overwrite  [line 175]

  void overwrite( string $element, array $values, [boolean $returnElement = false]  )

Applies the supplied values to the template and overwrites the content of el with the new node(s).

Parameters:
string   $element:  The context element
array   $values:  The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {'foo'=> 'bar'})
boolean   $returnElement:  (optional) true to return a Ext.Element (defaults to false)

API Tags:
Access:  public


[ Top ]
set  [line 186]

  void set( string $html, [boolean $compile = false]  )

Sets the HTML used as the template and optionally compiles it.

Parameters:
string   $html:  The HTML template
boolean   $compile:  (optional) True to compile the template (defaults to false)

API Tags:
Access:  public


[ Top ]

Documentation generated on Fri, 08 Aug 2008 16:01:04 -0500 by phpDocumentor 1.4.0