[ Index ]
 

Code source de PHP PEAR 1.4.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/HTML/Template/ -> ITX.php (sommaire)

(pas de description)

Poids: 832 lignes (28 kb)
Inclus ou requis: 2 fois
Référencé: 0 fois
Nécessite: 2 fichiers
 HTML/Template/IT.php
 HTML/Template/IT_Error.php

Définit 1 class

HTML_Template_ITX:: (22 méthodes):
  HTML_Template_ITX()
  init()
  replaceBlock()
  replaceBlockfile()
  addBlock()
  addBlockfile()
  placeholderExists()
  performCallback()
  getFunctioncalls()
  setFunctioncontent()
  setCallbackFuntiontable()
  removeBlockData()
  getBlocklist()
  blockExists()
  getBlockvariables()
  BlockvariableExists()
  buildFunctionlist()
  getValue()
  deleteFromBlockvariablelist()
  updateBlockvariablelist()
  findPlaceholderBlocks()
  warning()


Classe: HTML_Template_ITX  - X-Ref

Integrated Template Extension - ITX

With this class you get the full power of the phplib template class.
You may have one file with blocks in it but you have as well one main file
and multiple files one for each block. This is quite usefull when you have
user configurable websites. Using blocks not in the main template allows
you to modify some parts of your layout easily.

Note that you can replace an existing block and add new blocks at runtime.
Adding new blocks means changing a variable placeholder to a block.

HTML_Template_ITX($root = '')   X-Ref
Builds some complex regexps and calls the constructor
of the parent class.

Make sure that you call this constructor if you derive your own
template class from this one.


init()   X-Ref
Pas de description

replaceBlock($block, $template, $keep_content = false)   X-Ref
Replaces an existing block with new content.

This function will replace a block of the template and all blocks
contained in the replaced block and add a new block insted, means
you can dynamically change your template.

Note that changing the template structure violates one of the IT[X]
development goals. I've tried to write a simple to use template engine
supporting blocks. In contrast to other systems IT[X] analyses the way
you've nested blocks and knows which block belongs into another block.
The nesting information helps to make the API short and simple. Replacing
blocks does not only mean that IT[X] has to update the nesting
information (relatively time consumpting task) but you have to make sure
that you do not get confused due to the template change itself.

param: string      Blockname
param: string      Blockcontent
param: boolean     true if the new block inherits the content
return: boolean

replaceBlockfile($block, $filename, $keep_content = false)   X-Ref
Replaces an existing block with new content from a file.

param: string    Blockname
param: string    Name of the file that contains the blockcontent
param: boolean   true if the new block inherits the content of the old block

addBlock($placeholder, $blockname, $template)   X-Ref
Adds a block to the template changing a variable placeholder
to a block placeholder.

Add means "replace a variable placeholder by a new block".
This is different to PHPLibs templates. The function loads a
block, creates a handle for it and assigns it to a certain
variable placeholder. To to the same with PHPLibs templates you would
call set_file() to create the handle and parse() to assign the
parsed block to a variable. By this PHPLibs templates assume
that you tend to assign a block to more than one one placeholder.
To assign a parsed block to more than only the placeholder you specify
in this function you have to use a combination of getBlock()
and setVariable().

As no updates to cached data is necessary addBlock() and addBlockfile()
are rather "cheap" meaning quick operations.

The block content must not start with <!-- BEGIN blockname -->
and end with <!-- END blockname --> this would cause overhead and
produce an error.

param: string    Name of the variable placeholder, the name must be unique
param: string    Name of the block to be added
param: string    Content of the block
return: boolean

addBlockfile($placeholder, $blockname, $filename)   X-Ref
Adds a block taken from a file to the template changing a variable
placeholder to a block placeholder.

param: string    Name of the variable placeholder to be converted
param: string    Name of the block to be added
param: string    File that contains the block

placeholderExists($placeholder, $block = '')   X-Ref
Returns the name of the (first) block that contains
the specified placeholder.

param: string  Name of the placeholder you're searching
param: string  Name of the block to scan. If left out (default)
return: string  Name of the (first) block that contains

performCallback()   X-Ref
Checks the list of function calls in the template and
calls their callback function.


getFunctioncalls()   X-Ref
Returns a list of all function calls in the current template.

return: array

setFunctioncontent($functionID, $replacement)   X-Ref
Replaces a function call with the given replacement.

param: int       Function ID
param: string    Replacement

setCallbackFuntiontable($functions)   X-Ref
Pas de description

removeBlockData($block)   X-Ref
Recursively removes all data assiciated with a block, including all inner blocks

param: string  block to be removed

getBlocklist()   X-Ref
Returns a list of blocknames in the template.

return: array    [blockname => blockname]

blockExists($blockname)   X-Ref
Checks wheter a block exists.

param: string
return: boolean

getBlockvariables($block)   X-Ref
Returns a list of variables of a block.

param: string   Blockname
return: array    [varname => varname]

BlockvariableExists($block, $variable)   X-Ref
Checks wheter a block variable exists.

param: string    Blockname
param: string    Variablename
return: boolean

buildFunctionlist()   X-Ref
Builds a functionlist from the template.


getValue($code, $delimiter)   X-Ref
Truncates the given code from the first occurence of
$delimiter but ignores $delimiter enclosed by " or '.

param: string   The code which should be parsed
param: string   The delimiter char
return: string

deleteFromBlockvariablelist($block, $variables)   X-Ref
Deletes one or many variables from the block variable list.

param: string    Blockname
param: mixed     Name of one variable or array of variables

updateBlockvariablelist($block)   X-Ref
Updates the variable list of a block.

param: string    Blockname

findPlaceholderBlocks($variable)   X-Ref
Returns an array of blocknames where the given variable
placeholder is used.

param: string    Variable placeholder
return: array     $parents parents[0..n] = blockname

warning($message, $file = '', $line = 0)   X-Ref
Handles warnings, saves them to $warn and prints them or
calls die() depending on the flags

param: string    Warning
param: string    File where the warning occured
param: int       Linenumber where the warning occured



Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7