Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: c:/www/apache/doc2//redist/ITX.php
PHPDOC 2000/12/03 - PHPDoc

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 fileand multiple files one for each block. This is quite usefull when you haveuser configurable websites. Using blocks not in the main template allowsyou 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>
Version$ID: $

 

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.
boolean

replaceBlock(string $block, string $template)

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

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 owntemplate class from this one.

Returns void


replaceBlock

public boolean 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 previouslypassed data that is no longer referenced will be deleted. The internal listof allowed variables gets updated as well.In case the original block contains other blocks it must eighter have placeholderfor the inner blocks or contain them. If you want to use placeholder the placeholder mustlook like openingDelimiter."__".blockname."__".closingDelimiter .Due to the cache updates replaceBlock() and replaceBlockfile() are "expensive" operationswhich means extensive usage will slow down your script. So try to avoid them and ifyou can't do so try to use them before you pass lots of variables to the block you'rereplacing.

Parameter
string $block
string $template
Returns boolean

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

addBlock

public boolean 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 ablock, creates a handle for it and assigns it to a certainvariable placeholder. To to the same with PHPLibs templates you wouldcall set_file() to create the handle and parse() to assign theparsed block to a variable. By this PHPLibs templates assume that you tendto assign a block to more than one one placeholder. To assign a parsed blockto more than only the placeholder you specify in this function you haveto 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
of the variable placeholder, the name must be unique within the template.
string $blockname
of the block to be added
string $template
of the block
Returns boolean

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.
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 previouslypassed data that is no longer referenced will be deleted. The internal listof allowed variables gets updated as well.In case the original block contains other blocks it must eighter have placeholderfor the inner blocks or contain them. If you want to use placeholder the placeholder mustlook like openingDelimiter."__".blockname."__".closingDelimiter .Due to the cache updates replaceBlock() and replaceBlockfile() are "expensive" operationswhich means extensive usage will slow down your script. So try to avoid them and ifyou can't do so try to use them before you pass lots of variables to the block you'rereplacing.

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

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

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.
Add means "replace a variable placeholder by a new block".This is different to PHPLibs templates. The function loads ablock, creates a handle for it and assigns it to a certainvariable placeholder. To to the same with PHPLibs templates you wouldcall set_file() to create the handle and parse() to assign theparsed block to a variable. By this PHPLibs templates assume that you tendto assign a block to more than one one placeholder. To assign a parsed blockto more than only the placeholder you specify in this function you haveto 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
of the variable placeholder to be converted
string $blockname
of the block to be added
string $filename
that contains the block
Returns void

See Also addBlockfile()

deleteFromBlockvariablelist

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

  Deletes one or many variables from the block variable list.

Parameter
string $block
mixed $variables
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
Returns void


findPlaceholderBlocks

private array findPlaceholderBlocks( string $variable )

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

Parameter
string $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
string $file = >>""<<
where the warning occured
integer $line = >>0<<
where thr warning occured
Returns void

See Also $warn, $printWarning, $haltOnWarning

Public Field Details

$warn

public array $warn

>>array()<<

Array with all warnings.

See Also $printWarning, $haltOnWarning, warning()

$printWarning

public boolean $printWarning

>>false<<

Print warnings?

See Also $haltOnWarning, $warn, warning()

$haltOnWarning

public boolean $haltOnWarning

>>false<<

Call die() on warning?

See Also $warn, $printWarning, warning()

Private Field Details

$checkblocknameRegExp

private string $checkblocknameRegExp

>>""<<

RegExp used to test for a valid blockname.



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta