ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTML_Template_IT Class Reference
+ Inheritance diagram for HTML_Template_IT:
+ Collaboration diagram for HTML_Template_IT:

Public Member Functions

 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.
 init ()
 Clears all datafields of the object and rebuild the internal blocklist.
 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

 $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 124 of file IT.php.

Member Function Documentation

HTML_Template_IT::_addPregDelimiters (   $str)

Adds delimiters to a string, so it can be used as a pattern in preg_* functions.

Parameters
string
Returns
string

Definition at line 944 of file IT.php.

{
return '@' . $str . '@';
}
HTML_Template_IT::_preserveOpeningDelimiter (   $str)

Replaces an opening delimiter by a special string.

Parameters
string
Returns
string

Definition at line 955 of file IT.php.

{
return (false === strpos($str, $this->openingDelimiter))?
$str:
str_replace(
$this->openingDelimiter,
$this->openingDelimiter .
'%preserved%' . $this->closingDelimiter,
$str
);
}
HTML_Template_IT::buildBlockvariablelist ( )

Build a list of all variables within of a block.

Definition at line 813 of file IT.php.

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

{
foreach ($this->blocklist as $name => $content) {
preg_match_all($this->variablesRegExp, $content, $regs);
if (count($regs[1]) != 0) {
foreach ($regs[1] as $k => $var) {
$this->blockvariables[$name][$var] = true;
}
} else {
$this->blockvariables[$name] = array();
}
}
} // end func buildBlockvariablelist

+ Here is the caller graph for this function:

HTML_Template_IT::errorMessage (   $value,
  $blockname = '' 
)

Return a textual error message for a IT error code.

Parameters
integer$valueerror code
Returns
string error message, or false if the error code was not recognized

Definition at line 975 of file IT.php.

References PEAR\isError(), IT_BLOCK_DUPLICATE, IT_BLOCK_NOT_FOUND, IT_ERROR, IT_OK, IT_TPL_NOT_FOUND, and IT_UNKNOWN_OPTION.

Referenced by findBlocks(), get(), getFile(), parse(), setCurrentBlock(), setOption(), and touchBlock().

{
static $errorMessages;
if (!isset($errorMessages)) {
$errorMessages = array(
IT_OK => '',
IT_ERROR => 'unknown error',
IT_TPL_NOT_FOUND => 'Cannot read the template file',
IT_BLOCK_NOT_FOUND => 'Cannot find this block',
IT_BLOCK_DUPLICATE => 'The name of a block must be'.
' uniquewithin a template.'.
' Found "' . $blockname . '" twice.'.
'Unpredictable results '.
'may appear.',
IT_UNKNOWN_OPTION => 'Unknown option'
);
}
if (PEAR::isError($value)) {
$value = $value->getCode();
}
return isset($errorMessages[$value]) ?
$errorMessages[$value] : $errorMessages[IT_ERROR];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_IT::findBlocks (   $string)

Recusively builds a list of all blocks within the template.

Parameters
stringstring that gets scanned
See Also
$blocklist

Definition at line 854 of file IT.php.

References $blocklist, errorMessage(), IT_BLOCK_DUPLICATE, and PEAR\raiseError().

Referenced by HTML_Template_ITX\addBlock(), ilTemplate\init(), HTML_Template_ITX\init(), init(), and HTML_Template_ITX\replaceBlock().

{
$blocklist = array();
if (preg_match_all($this->blockRegExp, $string, $regs, PREG_SET_ORDER)) {
foreach ($regs as $k => $match) {
$blockname = $match[1];
$blockcontent = $match[2];
if (isset($this->blocklist[$blockname])) {
$this->err[] = PEAR::raiseError(
$this->errorMessage(
IT_BLOCK_DUPLICATE, $blockname),
);
$this->flagBlocktrouble = true;
}
$this->blocklist[$blockname] = $blockcontent;
$this->blockdata[$blockname] = "";
$blocklist[] = $blockname;
$inner = $this->findBlocks($blockcontent);
foreach ($inner as $k => $name) {
$pattern = sprintf(
'@<!--\s+BEGIN\s+%s\s+-->(.*)<!--\s+END\s+%s\s+-->@sm',
$name,
$name
);
$this->blocklist[$blockname] = preg_replace(
$pattern,
$this->openingDelimiter .
'__' . $name . '__' .
$this->closingDelimiter,
$this->blocklist[$blockname]
);
$this->blockinner[$blockname][] = $name;
$this->blockparents[$name] = $blockname;
}
}
}
return $blocklist;
} // end func findBlocks

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_IT::free ( )

Clears all datafields of the object.

Don't use this function unless you know what you're doing.

public

See Also
init()

Definition at line 710 of file IT.php.

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

{
$this->err = array();
$this->currentBlock = '__global__';
$this->variableCache = array();
$this->blocklist = array();
$this->touchedBlocks = array();
$this->flagBlocktrouble = false;
$this->flagGlobalParsed = false;
} // end func free

+ Here is the caller graph for this function:

HTML_Template_IT::get (   $block = '__global__')

Returns a block with all replacements done.

Parameters
stringname of the block
Returns
string
Exceptions
PEAR_Errorpublic
See Also
show()

Reimplemented in ilTemplate.

Definition at line 454 of file IT.php.

References $ret, errorMessage(), IT_BLOCK_NOT_FOUND, parse(), and PEAR\raiseError().

{
if ($block == '__global__' && !$this->flagGlobalParsed) {
$this->parse('__global__');
}
if (!isset($this->blocklist[$block])) {
$this->err[] = PEAR::raiseError(
'"' . $block . "'",
);
return '';
}
if (isset($this->blockdata[$block])) {
$ret = $this->blockdata[$block];
if ($this->clearCache) {
unset($this->blockdata[$block]);
}
if ($this->_options['preserve_data']) {
$ret = str_replace(
$this->openingDelimiter .
'%preserved%' . $this->closingDelimiter,
$this->openingDelimiter,
);
}
return $ret;
}
return '';
} // end func get()

+ Here is the call graph for this function:

HTML_Template_IT::getFile (   $filename)

Reads a file from disk and returns its content.

Parameters
stringFilename
Returns
string Filecontent

Definition at line 906 of file IT.php.

References $filename, errorMessage(), IT_TPL_NOT_FOUND, and PEAR\raiseError().

Referenced by HTML_Template_ITX\addBlockfile(), ilTemplate\addBlockFile(), loadTemplatefile(), ilTemplate\loadTemplatefile(), and HTML_Template_ITX\replaceBlockfile().

{
if ($filename{0} == '/' && substr($this->fileRoot, -1) == '/') {
$filename = substr($filename, 1);
}
$filename = $this->fileRoot . $filename;
if (!($fh = @fopen($filename, 'r'))) {
$this->err[] = PEAR::raiseError(
': "' .$filename .'"',
);
return "";
}
$fsize = filesize($filename);
if ($fsize < 1) {
fclose($fh);
return '';
}
$content = fread($fh, $fsize);
fclose($fh);
return preg_replace(
"#<!-- INCLUDE (.*) -->#ime", "\$this->getFile('\\1')", $content
);
} // end func getFile

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_IT::getGlobalvariables ( )

Returns a list of all global variables.

Definition at line 831 of file IT.php.

{
$regs = array();
$values = array();
foreach ($this->blockvariables['__global__'] as $allowedvar => $v) {
if (isset($this->variableCache[$allowedvar])) {
$regs[] = '@' . $this->openingDelimiter .
$allowedvar . $this->closingDelimiter . '@';
$values[] = $this->variableCache[$allowedvar];
unset($this->variableCache[$allowedvar]);
}
}
return array($regs, $values);
} // end func getGlobalvariables
HTML_Template_IT::HTML_Template_IT (   $root = '',
  $options = null 
)

Builds some complex regular expressions and optinally sets the file root directory.

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

Parameters
stringFile root directory, prefix for all filenames given to the object.
See Also
setRoot()

Definition at line 370 of file IT.php.

References $options, setOptions(), and setRoot().

Referenced by HTML_Template_ITX\HTML_Template_ITX().

{
if (!is_null($options)) {
}
$this->variablesRegExp = '@' . $this->openingDelimiter .
'(' . $this->variablenameRegExp . ')' .
$this->closingDelimiter . '@sm';
$this->removeVariablesRegExp = '@' . $this->openingDelimiter .
"\s*(" . $this->variablenameRegExp .
")\s*" . $this->closingDelimiter .'@sm';
$this->blockRegExp = '@<!--\s+BEGIN\s+(' . $this->blocknameRegExp .
')\s+-->(.*)<!--\s+END\s+\1\s+-->@sm';
$this->setRoot($root);
} // end constructor

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_IT::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 in HTML_Template_ITX, and ilTemplate.

Definition at line 693 of file IT.php.

References buildBlockvariablelist(), findBlocks(), and free().

Referenced by setTemplate().

{
$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:

+ Here is the caller graph for this function:

HTML_Template_IT::loadTemplatefile (   $filename,
  $removeUnknownVariables = true,
  $removeEmptyBlocks = true 
)

Reads a template file from the disk.

Parameters
stringname of the template file
boolhow to handle unknown variables.
boolhow to handle empty blocks. public
Returns
boolean false on failure, otherwise true
See Also
$template, setTemplate(), $removeUnknownVariables, $removeEmptyBlocks

Reimplemented in ilTemplate.

Definition at line 772 of file IT.php.

References $filename, $removeEmptyBlocks, $removeUnknownVariables, $template, getFile(), and setTemplate().

{
$template = '';
if (!$this->flagCacheTemplatefile ||
$this->lastTemplatefile != $filename
) {
}
$this->lastTemplatefile = $filename;
return $template != '' ?
$this->setTemplate(
) : false;
} // end func LoadTemplatefile

+ Here is the call graph for this function:

HTML_Template_IT::parse (   $block = '__global__',
  $flag_recursion = false 
)

Parses the given block.

Parameters
stringname of the block to be parsed public
See Also
parseCurrentBlock()
Exceptions
PEAR_Error

Definition at line 496 of file IT.php.

References $closingDelimiter, errorMessage(), IT_BLOCK_NOT_FOUND, and PEAR\raiseError().

Referenced by get(), and parseCurrentBlock().

{
static $regs, $values;
if (!isset($this->blocklist[$block])) {
$this->errorMessage( IT_BLOCK_NOT_FOUND ) . '"' . $block . "'",
);
}
if ($block == '__global__') {
$this->flagGlobalParsed = true;
}
if (!$flag_recursion) {
$regs = array();
$values = array();
}
$outer = $this->blocklist[$block];
$empty = true;
if ($this->clearCacheOnParse) {
foreach ($this->variableCache as $name => $value) {
$regs[] = $this->openingDelimiter .
$values[] = $value;
$empty = false;
}
$this->variableCache = array();
} else {
foreach ($this->blockvariables[$block] as $allowedvar => $v) {
if (isset($this->variableCache[$allowedvar])) {
$regs[] = $this->openingDelimiter .
$allowedvar . $this->closingDelimiter;
$values[] = $this->variableCache[$allowedvar];
unset($this->variableCache[$allowedvar]);
$empty = false;
}
}
}
if (isset($this->blockinner[$block])) {
foreach ($this->blockinner[$block] as $k => $innerblock) {
$this->parse($innerblock, true);
if ($this->blockdata[$innerblock] != '') {
$empty = false;
}
$placeholder = $this->openingDelimiter . "__" .
$innerblock . "__" . $this->closingDelimiter;
$outer = str_replace(
$placeholder,
$this->blockdata[$innerblock], $outer
);
$this->blockdata[$innerblock] = "";
}
}
if (!$flag_recursion && 0 != count($values)) {
if ($this->_options['use_preg']) {
$regs = array_map(array(
&$this, '_addPregDelimiters'),
$regs
);
$funcReplace = 'preg_replace';
} else {
$funcReplace = 'str_replace';
}
if ($this->_options['preserve_data']) {
$values = array_map(
array(&$this, '_preserveOpeningDelimiter'), $values
);
}
$outer = $funcReplace($regs, $values, $outer);
if ($this->removeUnknownVariables) {
$outer = preg_replace($this->removeVariablesRegExp, "", $outer);
}
}
if ($empty) {
if (!$this->removeEmptyBlocks) {
$this->blockdata[$block ].= $outer;
} else {
if (isset($this->touchedBlocks[$block])) {
$this->blockdata[$block] .= $outer;
unset($this->touchedBlocks[$block]);
}
}
} else {
if (empty($this->blockdata[$block])) {
$this->blockdata[$block] = $outer;
} else {
$this->blockdata[$block] .= $outer;
}
}
return $empty;
} // end func parse

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_IT::setCurrentBlock (   $block = '__global__')

Sets the name of the current block that is the block where variables are added.

Parameters
stringname of the block
Returns
boolean false on failure, otherwise true
Exceptions
PEAR_Errorpublic

Reimplemented in ilTemplate, and ilTemplate.

Definition at line 646 of file IT.php.

References errorMessage(), IT_BLOCK_NOT_FOUND, and PEAR\raiseError().

{
if (!isset($this->blocklist[$block])) {
'"' . $block . "'", IT_BLOCK_NOT_FOUND
);
}
$this->currentBlock = $block;
return true;
} // end func setCurrentBlock

+ Here is the call graph for this function:

HTML_Template_IT::setOption (   $option,
  $value 
)

Sets the option for the template class.

public

Parameters
stringoption name
mixedoption value
Returns
mixed IT_OK on success, error object on failure

Definition at line 397 of file IT.php.

References errorMessage(), IT_OK, IT_UNKNOWN_OPTION, and PEAR\raiseError().

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

{
if (array_key_exists($option, $this->_options)) {
$this->_options[$option] = $value;
return IT_OK;
}
$this->errorMessage(IT_UNKNOWN_OPTION) . ": '{$option}'",
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_IT::setOptions (   $options)

Sets the options for the template class.

public

Parameters
stringoptions array of options default value: 'preserve_data' => false, 'use_preg' => true
mixedoption value
Returns
mixed IT_OK on success, error object on failure
See Also
$options

Definition at line 422 of file IT.php.

References $options, PEAR\isError(), IT_OK, and setOption().

Referenced by HTML_Template_IT().

{
if (is_array($options)) {
foreach ($options as $option => $value) {
$error = $this->setOption($option, $value);
if (PEAR::isError($error)) {
return $error;
}
}
}
return IT_OK;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_IT::setRoot (   $root)

Sets the file root.

The file root gets prefixed to all filenames passed to the object.

Make sure that you override this function when using the class on windows.

Parameters
string
See Also
HTML_Template_IT() User interface

Definition at line 801 of file IT.php.

Referenced by HTML_Template_IT().

{
if ($root != '' && substr($root, -1) != '/') {
$root .= '/';
}
$this->fileRoot = $root;
} // end func setRoot

+ Here is the caller graph for this function:

HTML_Template_IT::setTemplate (   $template,
  $removeUnknownVariables = true,
  $removeEmptyBlocks = true 
)

Sets the template.

You can eighter load a template file from disk with LoadTemplatefile() or set the template manually using this function.

Parameters
stringtemplate content
booleanremove unknown/unused variables?
booleanremove empty blocks?
See Also
LoadTemplatefile(), $template User interface
Returns
boolean

Definition at line 737 of file IT.php.

References $removeEmptyBlocks, $removeUnknownVariables, $template, and init().

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

{
$this->removeUnknownVariables = $removeUnknownVariables;
$this->removeEmptyBlocks = $removeEmptyBlocks;
if ($template == '' && $this->flagCacheTemplatefile) {
$this->variableCache = array();
$this->blockdata = array();
$this->touchedBlocks = array();
$this->currentBlock = '__global__';
} else {
$this->template = '<!-- BEGIN __global__ -->' . $template .
'<!-- END __global__ -->';
$this->init();
}
if ($this->flagBlocktrouble) {
return false;
}
return true;
} // end func setTemplate

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTML_Template_IT::setVariable (   $variable,
  $value = '' 
)

Sets a variable value.

The function can be used eighter like setVariable( "varname", "value") or with one array $variables["varname"] = "value" given setVariable($variables) quite like phplib templates set_var().

Parameters
mixedstring with the variable name or an array variables["varname"] = "value"
stringvalue of the variable or empty if $variable is an array.
stringprefix for variable names public

Definition at line 626 of file IT.php.

Referenced by ilTemplate\addILIASFooter(), ilTemplate\fillAdminPanel(), ilTemplate\fillBodyClass(), ilTemplate\fillContentLanguage(), ilTemplate\fillContentStyle(), ilTemplate\fillCssFiles(), ilTemplate\fillHeader(), ilTemplate\fillInlineCss(), ilTemplate\fillJavaScriptFiles(), ilTemplate\fillLeftContent(), ilTemplate\fillLeftNav(), ilTemplate\fillLightbox(), ilTemplate\fillMainContent(), ilTemplate\fillMessage(), ilTemplate\fillNewContentStyle(), ilTemplate\fillOnLoadCode(), ilTemplate\fillPageFormAction(), ilTemplate\fillPermanentLink(), ilTemplate\fillRightContent(), ilTemplate\fillSideIcons(), ilTemplate\fillTabs(), ilTemplate\fillToolbar(), ilTemplate\fillVars(), ilTemplate\fillWindowTitle(), ilEMailInputGUI\insert(), ilCaptchaInputGUI\insert(), ilChatroomViewTask\renderFileUploadForm(), ilSurveyPageGUI\renderPageNode(), ilTemplate\replace(), ilTemplate\setCenterColumnClass(), ilTemplate\setFullscreenHeader(), ilTemplate\setLocator(), ilTemplate\setNewContentStyleSheetLocation(), ilTemplate\setStyleSheetLocation(), ilTemplate\setSubTabs(), ilTemplate\setTabs(), ilTemplate\setTopBar(), and ilTemplate\show().

{
if (is_array($variable)) {
$this->variableCache = array_merge(
$this->variableCache, $variable
);
} else {
$this->variableCache[$variable] = $value;
}
} // end func setVariable

+ Here is the caller graph for this function:

HTML_Template_IT::show (   $block = '__global__')

Print a certain block with all replacements done.

get()

Reimplemented in ilTemplate.

Definition at line 440 of file IT.php.

{
print $this->get($block);
} // end func show
HTML_Template_IT::touchBlock (   $block)

Preserves an empty block even if removeEmptyBlocks is true.

Parameters
stringname of the block
Returns
boolean false on false, otherwise true
Exceptions
PEAR_Errorpublic
See Also
$removeEmptyBlocks

Reimplemented in ilTemplate, and ilTemplate.

Definition at line 670 of file IT.php.

References errorMessage(), IT_BLOCK_NOT_FOUND, and PEAR\raiseError().

{
if (!isset($this->blocklist[$block])) {
'"' . $block . "'", IT_BLOCK_NOT_FOUND);
}
$this->touchedBlocks[$block] = true;
return true;
} // end func touchBlock

+ Here is the call graph for this function:

Field Documentation

array HTML_Template_IT::$_hiddenBlocks = array()

List of blocks which should not be shown even if not "empty".

See Also
hideBlock(), $removeEmptyBlocks

Definition at line 282 of file IT.php.

HTML_Template_IT::$_options
Initial value:
array(
'preserve_data' => false,
'use_preg' => true
)

$_options['preserve_data'] Whether to substitute variables and remove empty placeholders in data passed through setVariable (see also bugs #20199, #21951).

$_options['use_preg'] Whether to use preg_replace instead of str_replace in parse() (this is a backwards compatibility feature, see also bugs #21951, #20392)

Definition at line 354 of file IT.php.

HTML_Template_IT::$blockdata = array()

Definition at line 236 of file IT.php.

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

HTML_Template_IT::$blockinner = array()

Definition at line 248 of file IT.php.

Referenced by ilTemplate\init().

HTML_Template_IT::$blocklist = array()

Definition at line 229 of file IT.php.

Referenced by findBlocks(), HTML_Template_ITX\getBlocklist(), and ilTemplate\init().

HTML_Template_IT::$blocknameRegExp = '[\.0-9A-Za-z_-]+'

Definition at line 164 of file IT.php.

HTML_Template_IT::$blockRegExp = ''

Definition at line 209 of file IT.php.

HTML_Template_IT::$blockvariables = array()

Definition at line 242 of file IT.php.

Referenced by ilTemplate\init().

HTML_Template_IT::$clearCache = false

Definition at line 138 of file IT.php.

HTML_Template_IT::$clearCacheOnParse = false

Definition at line 305 of file IT.php.

HTML_Template_IT::$closingDelimiter = '}'

Definition at line 154 of file IT.php.

Referenced by HTML_Template_ITX\buildFunctionlist(), and parse().

HTML_Template_IT::$currentBlock = '__global__'

Definition at line 215 of file IT.php.

HTML_Template_IT::$err = array()

Definition at line 132 of file IT.php.

Referenced by ilTemplate\init().

HTML_Template_IT::$fileRoot = ''

Definition at line 313 of file IT.php.

HTML_Template_IT::$flagBlocktrouble = false

Definition at line 319 of file IT.php.

Referenced by ilTemplate\init().

HTML_Template_IT::$flagCacheTemplatefile = true

Definition at line 339 of file IT.php.

HTML_Template_IT::$flagGlobalParsed = false

Definition at line 325 of file IT.php.

HTML_Template_IT::$lastTemplatefile = ''

EXPERIMENTAL! FIXME!

Definition at line 344 of file IT.php.

HTML_Template_IT::$openingDelimiter = '{'

Definition at line 146 of file IT.php.

HTML_Template_IT::$removeEmptyBlocks = true

Definition at line 202 of file IT.php.

Referenced by loadTemplatefile(), ilTemplate\loadTemplatefile(), and setTemplate().

HTML_Template_IT::$removeUnknownVariables = true

Definition at line 195 of file IT.php.

Referenced by loadTemplatefile(), ilTemplate\loadTemplatefile(), and setTemplate().

HTML_Template_IT::$removeVariablesRegExp = ''

RegExp used to strip unused variable placeholder.

$variablesRegExp

Definition at line 188 of file IT.php.

array HTML_Template_IT::$touchedBlocks = array()

List of blocks to preverse even if they are "empty".

This is something special. Sometimes you have blocks that should be preserved although they are empty (no placeholder replaced). Think of a shopping basket. If it's empty you have to drop a message to the user. If it's filled you have to show the contents of the shopping baseket. Now where do you place the message that the basket is empty? It's no good idea to place it in you applications as customers tend to like unecessary minor text changes. Having another template file for an empty basket means that it's very likely that one fine day the filled and empty basket templates have different layout. I decided to introduce blocks that to not contain any placeholder but only text such as the message "Your shopping basked is empty".

Now if there is no replacement done in such a block the block will be recognized as "empty" and by default ($removeEmptyBlocks = true) be stripped off. To avoid thisyou can now call touchBlock() to avoid this.

The array $touchedBlocks stores a list of touched block which must not be removed even if they are empty.

See Also
touchBlock(), $removeEmptyBlocks

Definition at line 275 of file IT.php.

HTML_Template_IT::$variableCache = array()

Definition at line 294 of file IT.php.

HTML_Template_IT::$variablenameRegExp = '[\.0-9A-Za-z_-]+'

Definition at line 174 of file IT.php.

HTML_Template_IT::$variablesRegExp = ''

Definition at line 182 of file IT.php.


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