ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTML_Template_ITX Class Reference
+ Inheritance diagram for HTML_Template_ITX:
+ Collaboration diagram for HTML_Template_ITX:

Public Member Functions

 HTML_Template_ITX ($root= '')
 Builds some complex regexps and calls the constructor of the parent class.
 init ()
 Clears all datafields of the object and rebuild the internal blocklist.
 replaceBlock ($block, $template, $keep_content=false)
 Replaces an existing block with new content.
 replaceBlockfile ($block, $filename, $keep_content=false)
 Replaces an existing block with new content from a file.
 addBlock ($placeholder, $blockname, $template)
 Adds a block to the template changing a variable placeholder to a block placeholder.
 addBlockfile ($placeholder, $blockname, $filename)
 Adds a block taken from a file to the template changing a variable placeholder to a block placeholder.
 placeholderExists ($placeholder, $block= '')
 Returns the name of the (first) block that contains the specified placeholder.
 performCallback ()
 Checks the list of function calls in the template and calls their callback function.
 getFunctioncalls ()
 Returns a list of all function calls in the current template.
 setFunctioncontent ($functionID, $replacement)
 Replaces a function call with the given replacement.
 setCallbackFunction ($tplfunction, $callbackfunction, $callbackobject= '', $expandCallbackParameters=false)
 Sets a callback function.
 setCallbackFuntiontable ($functions)
 Sets the Callback function lookup table.
 removeBlockData ($block)
 Recursively removes all data assiciated with a block, including all inner blocks.
 getBlocklist ()
 Returns a list of blocknames in the template.
 blockExists ($blockname)
 Checks wheter a block exists.
 getBlockvariables ($block)
 Returns a list of variables of a block.
 BlockvariableExists ($block, $variable)
 Checks wheter a block variable exists.
 buildFunctionlist ()
 Builds a functionlist from the template.
 getValue ($code, $delimiter)
 Truncates the given code from the first occurence of $delimiter but ignores $delimiter enclosed by " or '.
 deleteFromBlockvariablelist ($block, $variables)
 Deletes one or many variables from the block variable list.
 updateBlockvariablelist ($block)
 Updates the variable list of a block.
 findPlaceholderBlocks ($variable)
 Returns an array of blocknames where the given variable placeholder is used.
 warning ($message, $file= '', $line=0)
 Handles warnings, saves them to $warn and prints them or calls die() depending on the flags.
- Public Member Functions inherited from HTML_Template_IT
 HTML_Template_IT ($root= '', $options=null)
 Builds some complex regular expressions and optinally sets the file root directory.
 setOption ($option, $value)
 Sets the option for the template class.
 setOptions ($options)
 Sets the options for the template class.
 show ($block= '__global__')
 Print a certain block with all replacements done.
 get ($block= '__global__')
 Returns a block with all replacements done.
 parse ($block= '__global__', $flag_recursion=false)
 Parses the given block.
 parseCurrentBlock ()
 Parses the current block.
 setVariable ($variable, $value= '')
 Sets a variable value.
 setCurrentBlock ($block= '__global__')
 Sets the name of the current block that is the block where variables are added.
 touchBlock ($block)
 Preserves an empty block even if removeEmptyBlocks is true.
 free ()
 Clears all datafields of the object.
 setTemplate ($template, $removeUnknownVariables=true, $removeEmptyBlocks=true)
 Sets the template.
 loadTemplatefile ($filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
 Reads a template file from the disk.
 setRoot ($root)
 Sets the file root.
 buildBlockvariablelist ()
 Build a list of all variables within of a block.
 getGlobalvariables ()
 Returns a list of all global variables.
 findBlocks ($string)
 Recusively builds a list of all blocks within the template.
 getFile ($filename)
 Reads a file from disk and returns its content.
 _addPregDelimiters ($str)
 Adds delimiters to a string, so it can be used as a pattern in preg_* functions.
 _preserveOpeningDelimiter ($str)
 Replaces an opening delimiter by a special string.
 errorMessage ($value, $blockname= '')
 Return a textual error message for a IT error code.

Data Fields

 $warn = array()
 $printWarning = false
 $haltOnWarning = false
 $checkblocknameRegExp = ''
 $functionPrefix = 'func_'
 $functionnameRegExp = '[_a-zA-Z]+[A-Za-z_0-9]*'
 $functionRegExp = ''
 $functions = array()
 $callback = array()
- Data Fields inherited from HTML_Template_IT
 $err = array()
 $clearCache = false
 $openingDelimiter = '{'
 $closingDelimiter = '}'
 $blocknameRegExp = '[\.0-9A-Za-z_-]+'
 $variablenameRegExp = '[\.0-9A-Za-z_-]+'
 $variablesRegExp = ''
 $removeVariablesRegExp = ''
 RegExp used to strip unused variable placeholder.
 $removeUnknownVariables = true
 $removeEmptyBlocks = true
 $blockRegExp = ''
 $currentBlock = '__global__'
 $template = ''
 $blocklist = array()
 $blockdata = array()
 $blockvariables = array()
 $blockinner = array()
 $touchedBlocks = array()
 List of blocks to preverse even if they are "empty".
 $_hiddenBlocks = array()
 List of blocks which should not be shown even if not "empty".
 $variableCache = array()
 $clearCacheOnParse = false
 $fileRoot = ''
 $flagBlocktrouble = false
 $flagGlobalParsed = false
 $flagCacheTemplatefile = true
 $lastTemplatefile = ''
 EXPERIMENTAL! FIXME!
 $_options
 $_options['preserve_data'] Whether to substitute variables and remove empty placeholders in data passed through setVariable (see also bugs #20199, #21951).

Detailed Description

Definition at line 41 of file ITX.php.

Member Function Documentation

HTML_Template_ITX::addBlock (   $placeholder,
  $blockname,
  $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 and end with this would cause overhead and produce an error.

Parameters
stringName of the variable placeholder, the name must be unique within the template.
stringName of the block to be added
stringContent of the block
Returns
boolean
Exceptions
IT_Error
See Also
addBlockfile() User interface

Definition at line 248 of file ITX.php.

References HTML_Template_IT\$template, deleteFromBlockvariablelist(), HTML_Template_IT\findBlocks(), findPlaceholderBlocks(), and updateBlockvariablelist().

Referenced by addBlockfile().

{
// Don't trust any user even if it's a programmer or yourself...
if ($placeholder == '') {
return new IT_Error('No variable placeholder given.',
__FILE__, __LINE__
);
} elseif ($blockname == '' ||
!preg_match($this->checkblocknameRegExp, $blockname)
) {
return new IT_Error("No or invalid blockname '$blockname' given.",
__FILE__, __LINE__
);
} elseif ($template == '') {
return new IT_Error('No block content given.', __FILE__, __LINE__);
} elseif (isset($this->blocklist[$blockname])) {
return new IT_Error('The block already exists.',
__FILE__, __LINE__
);
}
// find out where to insert the new block
$parents = $this->findPlaceholderBlocks($placeholder);
if (count($parents) == 0) {
return new IT_Error(
"The variable placeholder".
" '$placeholder' was not found in the template.",
__FILE__, __LINE__
);
} elseif (count($parents) > 1) {
reset($parents);
while (list($k, $parent) = each($parents)) {
$msg .= "$parent, ";
}
$msg = substr($parent, -2);
return new IT_Error("The variable placeholder "."'$placeholder'".
" must be unique, found in multiple blocks '$msg'.",
__FILE__, __LINE__
);
}
$template = "<!-- BEGIN $blockname -->" . $template . "<!-- END $blockname -->";
if ($this->flagBlocktrouble) {
return false; // findBlocks() already throws an exception
}
$this->blockinner[$parents[0]][] = $blockname;
$this->blocklist[$parents[0]] = preg_replace(
'@' . $this->openingDelimiter . $placeholder .
$this->closingDelimiter . '@',
$this->openingDelimiter . '__' . $blockname . '__' .
$this->closingDelimiter,
$this->blocklist[$parents[0]]
);
$this->deleteFromBlockvariablelist($parents[0], $placeholder);
$this->updateBlockvariablelist($blockname);
return true;
} // end func addBlock

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_ITX::addBlockfile (   $placeholder,
  $blockname,
  $filename 
)

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

Parameters
stringName of the variable placeholder to be converted
stringName of the block to be added
stringFile that contains the block addBlock() public

Definition at line 325 of file ITX.php.

References $filename, addBlock(), and HTML_Template_IT\getFile().

{
return $this->addBlock($placeholder, $blockname, $this->getFile($filename));
} // end func addBlockfile

+ Here is the call graph for this function:

HTML_Template_ITX::blockExists (   $blockname)

Checks wheter a block exists.

Parameters
string
Returns
boolean public
See Also
getBlocklist()

Reimplemented in ilTemplate, and ilTemplate.

Definition at line 578 of file ITX.php.

{
return isset($this->blocklist[$blockname]);
} // end func blockExists
HTML_Template_ITX::BlockvariableExists (   $block,
  $variable 
)

Checks wheter a block variable exists.

Parameters
stringBlockname
stringVariablename
Returns
boolean public
See Also
getBlockvariables()

Definition at line 614 of file ITX.php.

{
return isset($this->blockvariables[$block][$variable]);
} // end func BlockvariableExists
HTML_Template_ITX::buildFunctionlist ( )

Builds a functionlist from the template.

private

Definition at line 623 of file ITX.php.

References HTML_Template_IT\$closingDelimiter, HTML_Template_IT\$template, and getValue().

Referenced by ilTemplate\init(), and init().

{
$this->functions = array();
$num = 0;
while (preg_match($this->functionRegExp, $template, $regs)) {
$pos = strpos($template, $regs[0]);
$template = substr($template, $pos + strlen($regs[0]));
$head = $this->getValue($template, ')');
$args = array();
$search = $regs[0] . $head . ')';
$replace = $this->openingDelimiter .
'__function' . $num . '__' .
$this->template = str_replace($search, $replace, $this->template);
$template = str_replace($search, $replace, $template);
while ($head != '' && $args2 = $this->getValue($head, ',')) {
$arg2 = trim($args2);
$args[] = ('"' == $arg2{0} || "'" == $arg2{0}) ?
substr($arg2, 1, -1) : $arg2;
if ($arg2 == $head) {
break;
}
$head = substr($head, strlen($arg2) + 1);
}
$this->functions[$num++] = array(
'name' => $regs[1],
'args' => $args
);
}
} // end func buildFunctionlist

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_ITX::deleteFromBlockvariablelist (   $block,
  $variables 
)

Deletes one or many variables from the block variable list.

Parameters
stringBlockname
mixedName of one variable or array of variables ( array ( name => true ) ) to be stripped. private

Definition at line 726 of file ITX.php.

Referenced by addBlock().

{
if (!is_array($variables)) {
$variables = array($variables => true);
}
reset($this->blockvariables[$block]);
while (list($varname, $val) = each($this->blockvariables[$block])) {
if (isset($variables[$varname])) {
unset($this->blockvariables[$block][$varname]);
}
}
} // end deleteFromBlockvariablelist

+ Here is the caller graph for this function:

HTML_Template_ITX::findPlaceholderBlocks (   $variable)

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

Parameters
stringVariable placeholder
Returns
array $parents parents[0..n] = blockname public

Definition at line 783 of file ITX.php.

Referenced by addBlock().

{
$parents = array();
reset($this->blocklist);
while (list($blockname, $content) = each($this->blocklist)) {
reset($this->blockvariables[$blockname]);
while (
list($varname, $val) = each($this->blockvariables[$blockname]))
{
if ($variable == $varname) {
$parents[] = $blockname;
}
}
}
return $parents;
} // end func findPlaceholderBlocks

+ Here is the caller graph for this function:

HTML_Template_ITX::getBlocklist ( )

Returns a list of blocknames in the template.

Returns
array [blockname => blockname] public
See Also
blockExists()

Definition at line 560 of file ITX.php.

References HTML_Template_IT\$blocklist.

{
$blocklist = array();
foreach ($this->blocklist as $block => $content) {
$blocklist[$block] = $block;
}
return $blocklist;
} // end func getBlocklist
HTML_Template_ITX::getBlockvariables (   $block)

Returns a list of variables of a block.

Parameters
stringBlockname
Returns
array [varname => varname] public
See Also
BlockvariableExists()

Definition at line 591 of file ITX.php.

{
if (!isset($this->blockvariables[$block])) {
return array();
}
$variables = array();
foreach ($this->blockvariables[$block] as $variable => $v) {
$variables[$variable] = $variable;
}
return $variables;
} // end func getBlockvariables
HTML_Template_ITX::getFunctioncalls ( )

Returns a list of all function calls in the current template.

Returns
array public

Definition at line 431 of file ITX.php.

References $functions.

{
} // end func getFunctioncalls
HTML_Template_ITX::getValue (   $code,
  $delimiter 
)

Truncates the given code from the first occurence of $delimiter but ignores $delimiter enclosed by " or '.

private

Parameters
stringThe code which should be parsed
stringThe delimiter char
Returns
string
See Also
buildFunctionList()

Definition at line 675 of file ITX.php.

Referenced by buildFunctionlist().

{
if ($code == '') {
return '';
}
if (!is_array($delimiter)) {
$delimiter = array( $delimiter => true );
}
$len = strlen($code);
$enclosed = false;
$enclosed_by = '';
if (isset($delimiter[$code[0]])) {
$i = 1;
} else {
for ($i = 0; $i < $len; ++$i) {
$char = $code[$i];
if (
($char == '"' || $char == "'") &&
($char == $enclosed_by || '' == $enclosed_by) &&
(0 == $i || ($i > 0 && '\\' != $code[$i - 1]))
) {
if (!$enclosed) {
$enclosed_by = $char;
} else {
$enclosed_by = "";
}
$enclosed = !$enclosed;
}
if (!$enclosed && isset($delimiter[$char])) {
break;
}
}
}
return substr($code, 0, $i);
} // end func getValue

+ Here is the caller graph for this function:

HTML_Template_ITX::HTML_Template_ITX (   $root = '')

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.

See Also
HTML_Template_IT()

Definition at line 118 of file ITX.php.

References HTML_Template_IT\HTML_Template_IT().

Referenced by ilTemplateX\callConstructor().

{
$this->checkblocknameRegExp = '@' . $this->blocknameRegExp . '@';
$this->functionRegExp = '@' . $this->functionPrefix . '(' .
$this->functionnameRegExp . ')\s*\(@sm';
$this->HTML_Template_IT($root);
} // end func constructor

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_ITX::init ( )

Clears all datafields of the object and rebuild the internal blocklist.

LoadTemplatefile() and setTemplate() automatically call this function when a new template is given. Don't use this function unless you know what you're doing.

public

See Also
free()

Reimplemented from HTML_Template_IT.

Reimplemented in ilTemplate.

Definition at line 128 of file ITX.php.

References HTML_Template_IT\buildBlockvariablelist(), buildFunctionlist(), HTML_Template_IT\findBlocks(), and HTML_Template_IT\free().

{
$this->free();
$this->findBlocks($this->template);
// we don't need it any more
$this->template = '';
} // end func init

+ Here is the call graph for this function:

HTML_Template_ITX::performCallback ( )

Checks the list of function calls in the template and calls their callback function.

public

Definition at line 392 of file ITX.php.

References $GLOBALS.

{
reset($this->functions);
while (list($func_id, $function) = each($this->functions)) {
if (isset($this->callback[$function['name']])) {
if ($this->callback[$function['name']]['expandParameters']) {
$callFunction = 'call_user_func_array';
} else {
$callFunction = 'call_user_func';
}
if ($this->callback[$function['name']]['object'] != '') {
$call =
$callFunction(
array(
&$GLOBALS[$this->callback[$function['name']]['object']],
$this->callback[$function['name']]['function']),
$function['args']
);
} else {
$call =
$callFunction(
$this->callback[$function['name']]['function'],
$function['args']
);
}
$this->variableCache['__function' . $func_id . '__'] = $call;
}
}
} // end func performCallback
HTML_Template_ITX::placeholderExists (   $placeholder,
  $block = '' 
)

Returns the name of the (first) block that contains the specified placeholder.

Parameters
stringName of the placeholder you're searching
stringName of the block to scan. If left out (default) all blocks are scanned.
Returns
string Name of the (first) block that contains the specified placeholder. If the placeholder was not found or an error occured an empty string is returned.
Exceptions
IT_Errorpublic

Definition at line 344 of file ITX.php.

{
if ($placeholder == '') {
new IT_Error('No placeholder name given.', __FILE__, __LINE__);
return '';
}
if ($block != '' && !isset($this->blocklist[$block])) {
new IT_Error("Unknown block '$block'.", __FILE__, __LINE__);
return '';
}
// name of the block where the given placeholder was found
$found = '';
if ($block != '') {
if (is_array($variables = $this->blockvariables[$block])) {
// search the value in the list of blockvariables
reset($variables);
while (list($k, $variable) = each($variables)) {
if ($k == $placeholder) {
$found = $block;
break;
}
}
}
} else {
// search all blocks and return the name of the first block that
// contains the placeholder
reset($this->blockvariables);
while (list($blockname, $variables) = each($this->blockvariables)){
if (is_array($variables) && isset($variables[$placeholder])) {
$found = $blockname;
break;
}
}
}
return $found;
} // end func placeholderExists
HTML_Template_ITX::removeBlockData (   $block)

Recursively removes all data assiciated with a block, including all inner blocks.

Parameters
stringblock to be removed private

Definition at line 536 of file ITX.php.

Referenced by replaceBlock().

{
if (isset($this->blockinner[$block])) {
foreach ($this->blockinner[$block] as $k => $inner) {
$this->removeBlockData($inner);
}
unset($this->blockinner[$block]);
}
unset($this->blocklist[$block]);
unset($this->blockdata[$block]);
unset($this->blockvariables[$block]);
unset($this->touchedBlocks[$block]);
} // end func removeBlockinner

+ Here is the caller graph for this function:

HTML_Template_ITX::replaceBlock (   $block,
  $template,
  $keep_content = false 
)

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.

Parameters
stringBlockname
stringBlockcontent
booleantrue if the new block inherits the content of the old block
Returns
boolean
Exceptions
IT_Error
See Also
replaceBlockfile(), addBlock(), addBlockfile() User interface

Definition at line 164 of file ITX.php.

References HTML_Template_IT\$blockdata, HTML_Template_IT\$template, HTML_Template_IT\buildBlockvariablelist(), HTML_Template_IT\findBlocks(), and removeBlockData().

Referenced by replaceBlockfile().

{
if (!isset($this->blocklist[$block])) {
return new IT_Error(
"The block "."'$block'".
" does not exist in the template and thus it can't be replaced.",
__FILE__, __LINE__
);
}
if ($template == '') {
return new IT_Error('No block content given.', __FILE__, __LINE__);
}
if ($keep_content) {
$blockdata = $this->blockdata[$block];
}
// remove all kinds of links to the block / data of the block
$this->removeBlockData($block);
$template = "<!-- BEGIN $block -->" . $template . "<!-- END $block -->";
$parents = $this->blockparents[$block];
$this->blockparents[$block] = $parents;
// KLUDGE: rebuild the list for all block - could be done faster
if ($keep_content) {
$this->blockdata[$block] = $blockdata;
}
// old TODO - I'm not sure if we need this
// update caches
return true;
} // end func replaceBlock

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_ITX::replaceBlockfile (   $block,
  $filename,
  $keep_content = false 
)

Replaces an existing block with new content from a file.

replaceBlock()

Parameters
stringBlockname
stringName of the file that contains the blockcontent
booleantrue if the new block inherits the content of the old block public

Definition at line 212 of file ITX.php.

References $filename, HTML_Template_IT\getFile(), and replaceBlock().

{
return $this->replaceBlock($block, $this->getFile($filename), $keep_content);
} // end func replaceBlockfile

+ Here is the call graph for this function:

HTML_Template_ITX::setCallbackFunction (   $tplfunction,
  $callbackfunction,
  $callbackobject = '',
  $expandCallbackParameters = false 
)

Sets a callback function.

IT[X] templates (note the X) can contain simple function calls. "function call" means that the editor of the template can add special placeholder to the template like 'func_h1("embedded in h1")'. IT[X] will grab this function calls and allow you to define a callback function for them.

This is an absolutely evil feature. If your application makes heavy use of such callbacks and you're even implementing if-then etc. on the level of a template engine you're reiventing the wheel... - that's actually how PHP came into life. Anyway, sometimes it's handy.

Consider also using XML/XSLT or native PHP. And please do not push IT[X] any further into this direction of adding logics to the template engine.

For those of you ready for the X in IT[X]:

<?php ... function h_one($args) { return sprintf('

s

', $args[0]); }

... $itx = new HTML_Template_ITX( ... ); ... $itx->setCallbackFunction('h1', 'h_one'); $itx->performCallback(); ?>

template: func_h1('H1 Headline');

Parameters
stringFunction name in the template
stringName of the callback function
stringName of the callback object
booleanIf the callback is called with a list of parameters or with an array holding the parameters
Returns
boolean False on failure.
Exceptions
IT_Errorpublic
Deprecated:
The $callbackobject parameter is depricated since version 1.2 and might be dropped in further versions.

Definition at line 496 of file ITX.php.

{
if ($tplfunction == '' || $callbackfunction == '') {
return new IT_Error(
"No template function "."('$tplfunction')".
" and/or no callback function ('$callback') given.",
__FILE__, __LINE__
);
}
$this->callback[$tplfunction] = array(
'function' => $callbackfunction,
'object' => $callbackobject,
'expandParameters' => (boolean) $expandCallbackParameters
);
return true;
} // end func setCallbackFunction
HTML_Template_ITX::setCallbackFuntiontable (   $functions)

Sets the Callback function lookup table.

Parameters
arrayfunction table array[templatefunction] = array( "function" => userfunction, "object" => userobject ) public

Definition at line 525 of file ITX.php.

References $functions.

{
$this->callback = $functions;
} // end func setCallbackFunctiontable
HTML_Template_ITX::setFunctioncontent (   $functionID,
  $replacement 
)

Replaces a function call with the given replacement.

Parameters
intFunction ID
stringReplacement
Deprecated:

Definition at line 443 of file ITX.php.

{
$this->variableCache['__function' . $functionID . '__'] = $replacement;
} // end func setFunctioncontent
HTML_Template_ITX::updateBlockvariablelist (   $block)

Updates the variable list of a block.

Parameters
stringBlockname private

Definition at line 746 of file ITX.php.

Referenced by addBlock().

{
preg_match_all( $this->variablesRegExp,
$this->blocklist[$block], $regs
);
if (count($regs[1]) != 0) {
foreach ($regs[1] as $k => $var) {
$this->blockvariables[$block][$var] = true;
}
} else {
$this->blockvariables[$block] = array();
}
// check if any inner blocks were found
if (isset($this->blockinner[$block]) &&
is_array($this->blockinner[$block]) &&
count($this->blockinner[$block]) > 0
) {
/*
* loop through inner blocks, registering the variable
* placeholders in each
*/
foreach ($this->blockinner[$block] as $childBlock) {
$this->updateBlockvariablelist($childBlock);
}
}
} // end func updateBlockvariablelist

+ Here is the caller graph for this function:

HTML_Template_ITX::warning (   $message,
  $file = '',
  $line = 0 
)

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

Parameters
stringWarning
stringFile where the warning occured
intLinenumber where the warning occured
See Also
$warn, $printWarning, $haltOnWarning private

Definition at line 811 of file ITX.php.

References $file.

{
$message = sprintf(
'HTML_Template_ITX Warning: %s [File: %s, Line: %d]',
$message,
$line
);
$this->warn[] = $message;
if ($this->printWarning) {
print $message;
}
if ($this->haltOnWarning) {
die($message);
}
} // end func warning

Field Documentation

HTML_Template_ITX::$callback = array()

Definition at line 107 of file ITX.php.

HTML_Template_ITX::$checkblocknameRegExp = ''

Definition at line 71 of file ITX.php.

HTML_Template_ITX::$functionnameRegExp = '[_a-zA-Z]+[A-Za-z_0-9]*'

Definition at line 83 of file ITX.php.

HTML_Template_ITX::$functionPrefix = 'func_'

Definition at line 77 of file ITX.php.

HTML_Template_ITX::$functionRegExp = ''

Definition at line 93 of file ITX.php.

HTML_Template_ITX::$functions = array()

Definition at line 100 of file ITX.php.

Referenced by getFunctioncalls(), and setCallbackFuntiontable().

HTML_Template_ITX::$haltOnWarning = false

Definition at line 65 of file ITX.php.

HTML_Template_ITX::$printWarning = false

Definition at line 57 of file ITX.php.

HTML_Template_ITX::$warn = array()

Definition at line 49 of file ITX.php.


The documentation for this class was generated from the following file: