Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /home/cch/www/pear/PHPDoc/redist/ITX.php
PEAR Repository -

IntegratedTemplateExtension

IntegratedTemplate
   |
  +-- IntegratedTemplateExtension

Integrated Template Extension - ITX

 

public class IntegratedTemplateExtension extends IntegratedTemplate

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 some parts of your layout easily.

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

AuthorsUlf Wendel <uw@netuse.de>
Version1.0 22/09/00

 

Methods inherited from IntegratedTemplate

integratedtemplate, show, get, parse, parsecurrentblock, setvariable, setcurrentblock, init, free, settemplate, loadtemplatefile, setroot, buildblockvariablelist, getglobalvariables, findblocks, getfile, halt

Public Method Summary

void

IntegratedTemplateExtension()

Builds some complex regexps and calls the constructor of the parent class.
void

replaceBlock(string $block, string $template)

Replaces an existing block with new content. Warning: not implemented yet.
void

addBlock(string $placeholder, string $blockname, string $template)

Adds a block to the template changing a variable placeholder to a block placeholder.

Private Method Summary

void

replaceBlockfile(string $block, string $filename)

Replaces an existing block with new content from a file. Warning: not implemented yet.
void

addBlockfile(string $placeholder, string $blockname, string $filename)

Adds a block taken from a file to the template changing a variable placeholder to a block placeholder.
void

deleteFromBlockvariablelist(string $block, mixed $variables)

Deletes one or many variables from the block variable list.
void

updateBlockvariablelist(string $block)

Updates the variable list of a block.
array

findPlaceholderBlocks(string $variable)

Returns an array of blocknames where the given variable placeholder is used.
void

warning(string $message, [ string $file, integer $line ])

Handles warnings, saves them to $warn and prints them or calls die() depending on the flags

Fields inherited from IntegratedTemplate

$err, $printerror, $haltonerror, $clearcache, $openingdelimiter, $closingdelimiter, $blocknameregexp, $variablenameregexp, $variablesregexp, $blockregexp, $currentblock, $template, $blocklist, $blockdata, $blockvariables, $blockinner, $blocktypes, $variablecache, $clearcacheonparse, $removeunknownvariables, $removeemptyblocks, $fileroot, $flagblocktrouble, $flagglobalparsed

Public Field Summary

array

$warn

Array with all warnings.
boolean

$printWarning

Print warnings?
boolean

$haltOnWarning

Call die() on warning?

Private Field Summary

string

$checkblocknameRegExp

RegExp used to test for a valid blockname.

Public Method Details

IntegratedTemplateExtension

public void IntegratedTemplateExtension( )

  Builds some complex regexps and calls the constructor of the parent class.

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

Returns void

See Also IntegratedTemplate()

replaceBlock

public void replaceBlock( string $block, string $template )

  Replaces an existing block with new content. Warning: not implemented yet.

The Replacement does not affect previously added variables. All data is cached.
In case the new block does contain less or other variable placeholder the previously
passed data that is no longer referenced will be deleted. The internal list
of allowed variables gets updated as well.

In case the original block contains other blocks it must eighter have placeholder
for the inner blocks or contain them. If you want to use placeholder the placeholder must
look like openingDelimiter."__".blockname."__".closingDelimiter .

Due to the cache updates replaceBlock() and replaceBlockfile() are "expensive" operations
which means extensive usage will slow down your script. So try to avoid them and if
you can't do so try to use them before you pass lots of variables to the block you're
replacing.

Parameter
string $block
Blockname
string $template
Blockcontent
Returns void

See Also replaceBlockfile(), addBlock(), addBlockfile()

addBlock

public void addBlock( string $placeholder, string $blockname, string $template )

  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.

Parameter
string $placeholder
Name of the variable placeholder, the name must be unique within the template.
string $blockname
Name of the block to be added
string $template
Content of the block
Returns void

See Also addBlockfile()

Private Method Details

replaceBlockfile

private void replaceBlockfile( string $block, string $filename )

  Replaces an existing block with new content from a file. Warning: not implemented yet.

Parameter
string $block
Blockname
string $filename
Name of the file that contains the blockcontent
Returns void


addBlockfile

private void addBlockfile( string $placeholder, string $blockname, string $filename )

  Adds a block taken from a file to the template changing a variable placeholder to a block placeholder.

Parameter
string $placeholder
Name of the variable placeholder to be converted
string $blockname
Name of the block to be added
string $filename
File that contains the block
Returns void


deleteFromBlockvariablelist

private void deleteFromBlockvariablelist( string $block, mixed $variables )

  Deletes one or many variables from the block variable list.

Parameter
string $block
Blockname
mixed $variables
Name of one variable or array of variables ( array ( name => true ) ) to be stripped.
Returns void


updateBlockvariablelist

private void updateBlockvariablelist( string $block )

  Updates the variable list of a block.

Parameter
string $block
Blockname
Returns void


findPlaceholderBlocks

private array findPlaceholderBlocks( string $variable )

  Returns an array of blocknames where the given variable placeholder is used.

Parameter
string $variable
Variable placeholder
Returns array $parents

parents[0..n] = blockname


warning

private void warning( string $message, [ string $file, integer $line ] )

  Handles warnings, saves them to $warn and prints them or calls die() depending on the flags

Parameter
string $message
Warning
string $file = >>""<<
File where the warning occured
integer $line = >>0<<
Linenumber where thr warning occured
Returns void

See Also $warn, $printWarning, $haltOnWarning

Public Field Details

$warn

public array $warn

>>array()<<

See Also $printWarning, $haltOnWarning, warning()

$printWarning

public boolean $printWarning

>>false<<

See Also $haltOnWarning, $warn, warning()

$haltOnWarning

public boolean $haltOnWarning

>>false<<

See Also $warn, $printWarning, warning()

Private Field Details

$checkblocknameRegExp

private string $checkblocknameRegExp

>>""<<



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta