ILIAS
trunk Revision v11.0_alpha-1769-g99a433fe2dc
|
Integrated Template - IT Well there's not much to say about it. More...
Public Member Functions | |
__construct (string $root='', ?array $options=null) | |
Builds some complex regular expressions and optinally sets the file root directory. More... | |
setOption (string $option, $value) | |
Sets the option for the template class. More... | |
setOptions (array $options) | |
Sets the options for the template class. More... | |
show (string $block=self::IT_DEFAULT_BLOCK) | |
Print a certain block with all replacements done. More... | |
get (string $block=self::IT_DEFAULT_BLOCK) | |
Returns a block with all replacements done. More... | |
parse (string $block=self::IT_DEFAULT_BLOCK, bool $flag_recursion=false) | |
Parses the given block. More... | |
parseCurrentBlock () | |
Parses the current block. More... | |
setVariable ($variable, $value='') | |
Sets a variable value. More... | |
setCurrentBlock (string $block=self::IT_DEFAULT_BLOCK) | |
Sets the name of the current block that is the block where variables are added. More... | |
touchBlock (string $block) | |
Preserves an empty block even if removeEmptyBlocks is true. More... | |
free () | |
Clears all datafields of the object. More... | |
setTemplate (string $template, bool $removeUnknownVariables=true, bool $removeEmptyBlocks=true) | |
Sets the template. More... | |
loadTemplatefile (string $filename, bool $removeUnknownVariables=true, bool $removeEmptyBlocks=true) | |
Reads a template file from the disk. More... | |
setRoot (string $root) | |
Sets the file root. More... | |
buildBlockvariablelist () | |
Build a list of all variables within of a block. More... | |
findBlocks (string $string) | |
Recusively builds a list of all blocks within the template. More... | |
getFile (string $filename) | |
Reads a file from disk and returns its content. More... | |
_addPregDelimiters (string $str) | |
Adds delimiters to a string, so it can be used as a pattern in preg_* functions. More... | |
_preserveOpeningDelimiter (string $str) | |
Replaces an opening delimiter by a special string. More... | |
errorMessage (int $value, string $blockname='') | |
Return a textual error message for a IT error code. More... | |
Data Fields | |
const | IT_OK = 1 |
const | IT_ERROR = -1 |
const | IT_TPL_NOT_FOUND = -2 |
const | IT_BLOCK_NOT_FOUND = -3 |
const | IT_BLOCK_DUPLICATE = -4 |
const | IT_UNKNOWN_OPTION = -6 |
const | IT_DEFAULT_BLOCK = '__global__' |
array | $err = [] |
Contains the error objects. More... | |
bool | $clearCache = false |
Clear cache on get()? More... | |
string | $openingDelimiter = '{' |
First character of a variable placeholder ( _{_VARIABLE} ). More... | |
string | $closingDelimiter = '}' |
Last character of a variable placeholder ( {VARIABLE_}_ ). More... | |
string | $blocknameRegExp = '[\.0-9A-Za-z_-]+' |
RegExp matching a block in the template. More... | |
string | $variablenameRegExp = '[\.0-9A-Za-z_-]+' |
RegExp matching a variable placeholder in the template. More... | |
string | $variablesRegExp = '' |
RegExp used to find variable placeholder, filled by the constructor. More... | |
string | $removeVariablesRegExp = '' |
RegExp used to strip unused variable placeholder. More... | |
bool | $removeUnknownVariables = true |
Controls the handling of unknown variables, default is remove. More... | |
bool | $removeEmptyBlocks = true |
Controls the handling of empty blocks, default is remove. More... | |
string | $blockRegExp = '' |
RegExp used to find blocks an their content, filled by the constructor. More... | |
string | $currentBlock = self::IT_DEFAULT_BLOCK |
Name of the current block. More... | |
string | $template = '' |
Content of the template. More... | |
array | $blocklist = [] |
Array of all blocks and their content. More... | |
array | $blockdata = [] |
Array with the parsed content of a block. More... | |
array | $blockvariables = [] |
Array of variables in a block. More... | |
array | $blockparents = [] |
Array of block parents. More... | |
array | $blockinner = [] |
Array of inner blocks of a block. More... | |
array | $touchedBlocks = [] |
List of blocks to preverse even if they are "empty". More... | |
array | $variableCache = [] |
Variable cache. More... | |
bool | $clearCacheOnParse = false |
Clear the variable cache on parse? If you're not an expert just leave the default false. More... | |
string | $fileRoot = '' |
Root directory for all file operations. More... | |
bool | $flagBlocktrouble = false |
Internal flag indicating that a blockname was used multiple times. More... | |
bool | $flagGlobalParsed = false |
Flag indicating that the global block was parsed. More... | |
bool | $flagCacheTemplatefile = true |
EXPERIMENTAL! FIXME! Flag indication that a template gets cached. More... | |
string | $lastTemplatefile = '' |
EXPERIMENTAL! FIXME! More... | |
array | $_options |
$_options['preserve_data'] Whether to substitute variables and remove empty placeholders in data passed through setVariable (see also bugs #20199, #21951). More... | |
Protected Member Functions | |
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. More... | |
Protected Attributes | |
array string | $real_filename = '' |
Holds the real template file name. More... | |
Private Attributes | |
ILIAS Cache Container Container | $block_cache |
ILIAS Cache Container Container | $variable_cache |
ILIAS Cache Container Container | $template_cache |
Integrated Template - IT Well there's not much to say about it.
I needed a template class that supports a single template file with multiple (nested) blocks inside and a simple block API. The Isotemplate API is somewhat tricky for a beginner although it is the best one you can build. template::parse() [phplib template = Isotemplate] requests you to name a source and a target where the current block gets parsed into. Source and target can be block names or even handler names. This API gives you a maximum of fexibility but you always have to know what you do which is quite unusual for php skripter like me. I noticed that I do not any control on which block gets parsed into which one. If all blocks are within one file, the script knows how they are nested and in which way you have to parse them. IT knows that inner1 is a child of block2, there's no need to tell him about this.
global (hidden and automatically added) | |||||
block1 |
|
To add content to block1 you simply type: $tpl->setCurrentBlock("block1");
and repeat this as often as needed: $tpl->setVariable(...); $tpl->parseCurrentBlock();
To add content to block2 you would type something like: $tpl->setCurrentBlock("inner1"); $tpl->setVariable(...); $tpl->parseCurrentBlock(); $tpl->setVariable(...); $tpl->parseCurrentBlock(); $tpl->parse("block1");
This will result in one repition of block1 which contains two repitions of inner1. inner2 will be removed if $removeEmptyBlock is set to true which is the default. Usage: $tpl = new HTML_Template_IT( [string filerootdir] ); // load a template or set it with setTemplate() $tpl->loadTemplatefile( string filename [, boolean removeUnknownVariables, boolean removeEmptyBlocks] ) // set "global" Variables meaning variables not beeing within a (inner) block $tpl->setVariable( string variablename, mixed value ); // like with the Isotemplates there's a second way to use setVariable() $tpl->setVariable( array ( string varname => mixed value ) ); // Let's use any block, even a deeply nested one $tpl->setCurrentBlock( string blockname ); // repeat this as often as you need it. $tpl->setVariable( array ( string varname => mixed value ) ); $tpl->parseCurrentBlock(); // get the parsed template or print it: $tpl->show() $tpl->get();
HTML_Template_IT::__construct | ( | string | $root = '' , |
?array | $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.
string | $root | File root directory, prefix for all filenames given to the object. |
string[] | $options array of options. |
ilTemplateException |
Definition at line 322 of file IT.php.
References $DIC, setOptions(), and setRoot().
HTML_Template_IT::_addPregDelimiters | ( | string | $str | ) |
HTML_Template_IT::_preserveOpeningDelimiter | ( | string | $str | ) |
Replaces an opening delimiter by a special string.
HTML_Template_IT::buildBlockvariablelist | ( | ) |
Build a list of all variables within of a block.
Definition at line 713 of file IT.php.
Referenced by ilTemplate\init(), HTML_Template_ITX\init(), init(), and HTML_Template_ITX\replaceBlock().
HTML_Template_IT::errorMessage | ( | int | $value, |
string | $blockname = '' |
||
) |
Return a textual error message for a IT error code.
Definition at line 833 of file IT.php.
Referenced by findBlocks(), get(), getFile(), parse(), setCurrentBlock(), setOption(), and touchBlock().
HTML_Template_IT::findBlocks | ( | string | $string | ) |
Recusively builds a list of all blocks within the template.
ilTemplateException |
Definition at line 732 of file IT.php.
References $blocklist, and errorMessage().
Referenced by HTML_Template_ITX\addBlock(), ilTemplate\init(), HTML_Template_ITX\init(), init(), and HTML_Template_ITX\replaceBlock().
HTML_Template_IT::free | ( | ) |
Clears all datafields of the object.
Don't use this function unless you know what you're doing.
Definition at line 623 of file IT.php.
Referenced by ilTemplate\init(), HTML_Template_ITX\init(), and init().
HTML_Template_IT::get | ( | string | $block = self::IT_DEFAULT_BLOCK | ) |
Returns a block with all replacements done.
ilTemplateException |
Definition at line 388 of file IT.php.
References errorMessage(), and parse().
HTML_Template_IT::getFile | ( | string | $filename | ) |
Reads a file from disk and returns its content.
ilTemplateException |
Definition at line 777 of file IT.php.
References $filename, errorMessage(), and null.
Referenced by ilTemplate\addBlockFile(), HTML_Template_ITX\addBlockfile(), ilTemplate\loadTemplatefile(), and loadTemplatefile().
|
protected |
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.
ilTemplateException |
Definition at line 594 of file IT.php.
References $blockdata, $blocklist, $blockvariables, buildBlockvariablelist(), findBlocks(), free(), and null.
Referenced by setTemplate().
HTML_Template_IT::loadTemplatefile | ( | string | $filename, |
bool | $removeUnknownVariables = true , |
||
bool | $removeEmptyBlocks = true |
||
) |
Reads a template file from the disk.
ilTemplateException |
Definition at line 675 of file IT.php.
References $filename, getFile(), and setTemplate().
Referenced by ilIndependantTemplate\loadTemplatefile().
HTML_Template_IT::parse | ( | string | $block = self::IT_DEFAULT_BLOCK , |
bool | $flag_recursion = false |
||
) |
Parses the given block.
string | name of the block to be parsed public |
ilTemplateException |
Definition at line 424 of file IT.php.
References $closingDelimiter, and errorMessage().
Referenced by get(), and parseCurrentBlock().
HTML_Template_IT::parseCurrentBlock | ( | ) |
Parses the current block.
ilTemplateException |
Definition at line 529 of file IT.php.
References parse().
Referenced by ilTemplate\touchBlock().
HTML_Template_IT::setCurrentBlock | ( | string | $block = self::IT_DEFAULT_BLOCK | ) |
Sets the name of the current block that is the block where variables are added.
ilTemplateException |
Definition at line 561 of file IT.php.
References errorMessage().
HTML_Template_IT::setOption | ( | string | $option, |
$value | |||
) |
Sets the option for the template class.
mixed | $value |
ilTemplateException |
Definition at line 351 of file IT.php.
References errorMessage().
Referenced by ilTemplate\__construct(), and setOptions().
HTML_Template_IT::setOptions | ( | array | $options | ) |
Sets the options for the template class.
string[] | $options |
ilTemplateException |
Definition at line 366 of file IT.php.
References setOption().
Referenced by __construct().
HTML_Template_IT::setRoot | ( | string | $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.
Definition at line 701 of file IT.php.
Referenced by __construct().
HTML_Template_IT::setTemplate | ( | string | $template, |
bool | $removeUnknownVariables = true , |
||
bool | $removeEmptyBlocks = true |
||
) |
Sets the template.
You can eighter load a template file from disk with LoadTemplatefile() or set the template manually using this function.
ilTemplateException |
Definition at line 643 of file IT.php.
References $removeEmptyBlocks, $removeUnknownVariables, and init().
Referenced by ilTemplate\loadTemplatefile(), and loadTemplatefile().
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().
string | array | $variable | string with the variable name or an array variables["varname"] = "value" |
mixed | $value | value of the variable or empty if $variable is an array. |
Definition at line 544 of file IT.php.
Referenced by ilContainerRenderer\addHeaderRow(), ilContainerGUI\addHeaderRow(), ilContainerGUI\addMessageRow(), ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), ILIAS\Test\Questions\Presentation\Printer\addQuestionResultForTestUsersToTemplate(), ILIAS\Test\Questions\Presentation\Printer\addResultUserInfoToTemplate(), ilExerciseGSToolProvider\addSection(), ilContainerRenderer\addStandardRow(), ilCalendarBlockGUI\addSubscriptionButton(), ILIAS\Survey\Mode\AbstractUIModifier\buildExportButtonAndModal(), ilTimingsCronReminder\buildMailSalutation(), ilRecurrenceInputGUI\buildMonthlyByDaySelection(), ilRecurrenceInputGUI\buildMonthlyByMonthDaySelection(), ilRecurrenceInputGUI\buildUntilSelection(), ilRecurrenceInputGUI\buildWeekDaySelection(), ilRecurrenceInputGUI\buildYearlyByDaySelection(), ilRecurrenceInputGUI\buildYearlyByMonthDaySelection(), ilKprimChoiceCorrectionsInputGUI\checkInput(), ilTimingsCronReminder\fillObjectListForMailBody(), ilStudyProgrammeProgressListGUI\fillTemplate(), ilStudyProgrammeExpandableProgressListGUI\fillTemplate(), ilTemplate\fillVars(), ilSCORMExplorer\formatHeader(), ilContainerSelectionExplorer\formatHeader(), ilSearchRootSelector\formatHeader(), ilECSNodeMappingLocalExplorer\formatHeader(), ilECSNodeMappingCmsExplorer\formatHeader(), ilPasteIntoMultipleItemsExplorer\formatHeader(), ilRepositoryExplorer\formatHeader(), ilECSNodeMappingLocalExplorer\formatObject(), ilPasteIntoMultipleItemsExplorer\formatObject(), ilExplorer\formatObject(), ilCalendarViewGUI\getContentByPlugins(), ilAbstractLearningHistoryProvider\getEmphasizedTitle(), ilRepositoryObjectSearchBlockGUI\getLegacyContent(), ilWikiFunctionsBlockGUI\getLegacyContent(), ilCalendarSelectionBlockGUI\getLegacyContent(), ilSCORMExplorer\getOutputIcons(), ilMailFormAttachmentPropertyGUI\insert(), ilAssLongmenuCorrectionsInputGUI\insert(), ilAssClozeTestCombinationVariantsInputGUI\insert(), ilAssSingleChoiceCorrectionsInputGUI\insert(), ilAssErrorTextCorrectionsInputGUI\insert(), ilOrgUnitAuthorityInputGUI\insert(), ilAssAnswerCorrectionsInputGUI\insert(), ilCustomInputGUI\insert(), ilHiddenInputGUI\insert(), ilAssMultipleChoiceCorrectionsInputGUI\insert(), ilAssMatchingPairCorrectionsInputGUI\insert(), ilImagemapCorrectionsInputGUI\insert(), ilEssayKeywordWizardInputGUI\insert(), ilFontSizeInputGUI\insert(), ilBackgroundImageInputGUI\insert(), ilNumericStyleValueInputGUI\insert(), ilManualPlaceholderInputGUI\insert(), ilRadioGroupInputGUI\insert(), ilFormSectionHeaderGUI\insert(), ilTextWizardInputGUI\insert(), ilWidthHeightInputGUI\insert(), ilSelectBuilderInputGUI\insert(), ilEMailInputGUI\insert(), ilImageFileInputGUI\insert(), ilUserLoginInputGUI\insert(), ilLocationInputGUI\insert(), ilNestedListInputGUI\insert(), ilCheckboxGroupInputGUI\insert(), ilAdvSelectInputGUI\insert(), ilBackgroundPositionInputGUI\insert(), ilTRBLBorderStyleInputGUI\insert(), ilKprimChoiceWizardInputGUI\insert(), ilNonEditableValueGUI\insert(), ilCheckboxInputGUI\insert(), ilMatrixRowWizardInputGUI\insert(), ilTRBLBorderWidthInputGUI\insert(), ilTRBLNumericStyleValueInputGUI\insert(), ilChatroomAuthInputGUI\insert(), ilDurationInputGUI\insert(), ilTagInputGUI\insert(), ilFileWizardInputGUI\insert(), ilTRBLColorPickerInputGUI\insert(), ilMatchingPairWizardInputGUI\insert(), ilColorPickerInputGUI\insert(), ilMultipleChoiceWizardInputGUI\insert(), ilCSSRectInputGUI\insert(), ilMultiSelectInputGUI\insert(), ilCombinationInputGUI\insert(), ilSelectInputGUI\insert(), ilScheduleInputGUI\insert(), ilRepositorySelectorInputGUI\insert(), ilExplorerSelectInputGUI\insert(), ilErrorTextWizardInputGUI\insert(), ilDateTimeInputGUI\insert(), ilNumberInputGUI\insert(), ilAnswerWizardInputGUI\insert(), ilRecurrenceInputGUI\insert(), ilMatchingWizardInputGUI\insert(), ilCategoryWizardInputGUI\insert(), ilImagemapFileInputGUI\insert(), ilPasswordInputGUI\insert(), ilTextAreaInputGUI\insert(), ilDclGenericMultiInputGUI\insert(), ilOrgUnitGenericMultiInputGUI\insert(), ilFileInputGUI\insert(), ilSingleChoiceWizardInputGUI\insert(), ilTextInputGUI\insert(), ilDateDurationInputGUI\insert(), ilLinkInputGUI\insert(), ilPCParagraphGUI\insertCharacteristicTable(), ilPCParagraphGUI\insertHelp(), ilSCORMExplorer\insertObject(), ilNestedList\listItemStart(), ilExplorerBaseGUI\listItemStart(), ilNestedList\listStart(), ilSurveyExecutionGUI\outNavigationButtons(), SurveyMetricQuestion\outPreconditionSelectValue(), ilFileInputGUI\outputSuffixes(), SurveyQuestionGUI\outQuestionText(), assMatchingQuestionGUI\populateAssignedTerms(), ilAssQuestionPreviewGUI\populateCommentsPanel(), assMatchingQuestionGUI\populateDefinition(), ilTestServiceGUI\populateExamId(), ilAssQuestionPreviewGUI\populateGenericQuestionFeedback(), ilAssQuestionPreviewGUI\populateInstantResponseHeader(), ilAssQuestionPreviewGUI\populateInstantResponseMessage(), ilTestServiceGUI\populatePassFinishDate(), ilAssQuestionPreviewGUI\populateQuestionOutput(), ilAssQuestionPreviewGUI\populateReachedPointsOutput(), ilAssQuestionPreviewGUI\populateSolutionOutput(), ilAssQuestionPreviewGUI\populateSpecificQuestionFeedback(), ilPollAnswersRenderer\render(), ILIAS\Exercise\Assignment\PanelBuilderUI\renderActionButton(), ilTestQuestionNavigationGUI\renderActionsIcon(), ilPollContentRenderer\renderAlertForAnonymousUser(), ilPollContentRenderer\renderAnchor(), ilPollContentRenderer\renderAnonimityInfo(), ilPollAnswersRenderer\renderAnswer(), ilPollContentRenderer\renderAvailability(), ilPollResultsRenderer\renderBarChart(), ilTestQuestionNavigationGUI\renderButtonInstance(), ilExplorerBaseGUI\renderChilds(), ilPollContentRenderer\renderComments(), ilAssLacLegendGUI\renderCommonLegendPart(), ilNewsTimelineGUI\renderDeleteModal(), ilPollContentRenderer\renderDescription(), ilContainerRenderer\renderDetails(), ilObjForumGUI\renderDraftContent(), ilNewsTimelineGUI\renderEditModal(), ilAssLacLegendGUI\renderExample(), ilContainerRenderer\renderHelperGeneric(), ilCalendarSelectionBlockGUI\renderItem(), ILIAS\Chatroom\BuildChat\renderLanguageVariables(), ILIAS\Exercise\Assignment\PanelBuilderUI\renderLinkList(), ilPollContentRenderer\renderMiscVoteInfo(), ilNestedList\renderNode(), ilExplorerBaseGUI\renderNode(), ilPollContentRenderer\renderNoQuestionMessage(), ilPollContentRenderer\renderNotAbleToVoteMessage(), ilPollContentRenderer\renderNotWithinVotingPeriodMessage(), ilObjForumGUI\renderPostContent(), ilObjForumGUI\renderPostingForm(), ilPollContentRenderer\renderQuestion(), ilAssLacLegendGUI\renderQuestSpecificExamples(), ilAssLacLegendGUI\renderQuestSpecificLegendPart(), ilChatroomViewGUI\renderRightUsersBlock(), ilContainerRenderer\renderSelectAllBlock(), ilChatroomViewGUI\renderSendMessageBox(), ilObjForumGUI\renderSplitButton(), ilPollResultsRenderer\renderStackedChart(), ilPollContentRenderer\renderTotalParticipantsInfo(), ilClozeGapInputBuilderGUI\setValueByArray(), ilPDNewsBlockGUI\showFeedUrl(), ilNewsForContextBlockGUI\showFeedUrl(), ilInfoScreenGUI\showLearningProgress(), and ilNewsForContextBlockGUI\showNews().
HTML_Template_IT::show | ( | string | $block = self::IT_DEFAULT_BLOCK | ) |
Print a certain block with all replacements done.
ilTemplateException |
HTML_Template_IT::touchBlock | ( | string | $block | ) |
Preserves an empty block even if removeEmptyBlocks is true.
ilTemplateException |
Definition at line 576 of file IT.php.
References errorMessage().
array HTML_Template_IT::$_options |
$_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)
array HTML_Template_IT::$blockdata = [] |
Array with the parsed content of a block.
Definition at line 209 of file IT.php.
Referenced by ilTemplate\init(), init(), and HTML_Template_ITX\replaceBlock().
array HTML_Template_IT::$blockinner = [] |
Array of inner blocks of a block.
Definition at line 224 of file IT.php.
Referenced by ilTemplate\init().
array HTML_Template_IT::$blocklist = [] |
Array of all blocks and their content.
Definition at line 204 of file IT.php.
Referenced by findBlocks(), ilTemplate\init(), and init().
string HTML_Template_IT::$blocknameRegExp = '[\.0-9A-Za-z_-]+' |
array HTML_Template_IT::$blockparents = [] |
string HTML_Template_IT::$blockRegExp = '' |
array HTML_Template_IT::$blockvariables = [] |
Array of variables in a block.
Definition at line 214 of file IT.php.
Referenced by ilTemplate\init(), and init().
bool HTML_Template_IT::$clearCache = false |
bool HTML_Template_IT::$clearCacheOnParse = false |
string HTML_Template_IT::$closingDelimiter = '}' |
Last character of a variable placeholder ( {VARIABLE_}_ ).
Definition at line 149 of file IT.php.
Referenced by HTML_Template_ITX\buildFunctionlist(), and parse().
string HTML_Template_IT::$currentBlock = self::IT_DEFAULT_BLOCK |
array HTML_Template_IT::$err = [] |
string HTML_Template_IT::$fileRoot = '' |
bool HTML_Template_IT::$flagBlocktrouble = false |
Internal flag indicating that a blockname was used multiple times.
Definition at line 272 of file IT.php.
Referenced by ilTemplate\init().
bool HTML_Template_IT::$flagCacheTemplatefile = true |
EXPERIMENTAL! FIXME! Flag indication that a template gets cached.
Complex templates require some times to be preparsed before the replacement can take place. Often I use one template file over and over again but I don't know before that I will use the same template file again. Now IT could notice this and skip the preparse.
bool HTML_Template_IT::$flagGlobalParsed = false |
string HTML_Template_IT::$lastTemplatefile = '' |
string HTML_Template_IT::$openingDelimiter = '{' |
|
protected |
bool HTML_Template_IT::$removeEmptyBlocks = true |
Controls the handling of empty blocks, default is remove.
Definition at line 184 of file IT.php.
Referenced by ilTemplate\loadTemplatefile(), and setTemplate().
bool HTML_Template_IT::$removeUnknownVariables = true |
Controls the handling of unknown variables, default is remove.
Definition at line 179 of file IT.php.
Referenced by ilTemplate\loadTemplatefile(), and setTemplate().
string HTML_Template_IT::$removeVariablesRegExp = '' |
string HTML_Template_IT::$template = '' |
Content of the template.
Definition at line 199 of file IT.php.
Referenced by ilTemplate\addBlockFile(), HTML_Template_ITX\buildFunctionlist(), and ilTemplate\loadTemplatefile().
array HTML_Template_IT::$touchedBlocks = [] |
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.
array HTML_Template_IT::$variableCache = [] |
string HTML_Template_IT::$variablenameRegExp = '[\.0-9A-Za-z_-]+' |
string HTML_Template_IT::$variablesRegExp = '' |
const HTML_Template_IT::IT_DEFAULT_BLOCK = '__global__' |
Definition at line 126 of file IT.php.
Referenced by ilTemplate\__construct().