diff --git a/modules/web/doc_classes/HTMLTemplate.xml b/modules/web/doc_classes/HTMLTemplate.xml index ae3d7da1c..55a3861e8 100644 --- a/modules/web/doc_classes/HTMLTemplate.xml +++ b/modules/web/doc_classes/HTMLTemplate.xml @@ -1,8 +1,13 @@ + A class that can be used to easily script and render HTML with. + A class that can be used to easily render HTML with. An instance of this class could be a traditional web application's View. + Some traditional web applications use a templating language to render their final output using a set of variables. Some examples: Blade, Handlebars, Razor, etc. Some of these have features like for loops, ifs, they can even support method calls. Thic class implements similar functinality, albeit in a different manner. + The render control logic should be implemented by overriding [method _render], variable substitotions can be done using the available helper methods. + Note: For a different approach to generating HTML, you can also take a look at [HTMLBuilder]. @@ -12,27 +17,32 @@ + Override this method to implement your own rendering for any given HTMLTemplate. + Adds a [HTMLTemplateData] template. + Clears template defaults. + Clears template overrides. + Clears templates. @@ -41,65 +51,76 @@ + Gets a template string using [method get_template] and does variable substitutions on it. + Gets a template. + Returns the template count. + Returns a default template value previously set. + Returns an override template value previously set. + Returns a template text identified by name. This method first looks into overrides, then it tries to get it from [member templates] (in order), and then it tries default values. + Returns whether a template default denoted by name is set. + Returns whether a template override denoted by name is set. + Removes a template. + Removes a template default. + Removes a template override. @@ -107,6 +128,7 @@ + Use this method to render the final output. This calls [method _render]. @@ -115,6 +137,7 @@ + Helper method that does variable substitutions on a given text. @@ -122,6 +145,7 @@ + Sets a template default value. @@ -129,6 +153,7 @@ + Sets a template override value. @@ -136,6 +161,7 @@ + Helper method that does data variable substitutions on a given text. @@ -143,15 +169,19 @@ + Helper method that does request variable substitutions on a given text. + Returns all template default values. + Returns all template override values. + Returns all templates. diff --git a/modules/web/doc_classes/HTMLTemplateData.xml b/modules/web/doc_classes/HTMLTemplateData.xml index 4b07ed89d..63b6beba5 100644 --- a/modules/web/doc_classes/HTMLTemplateData.xml +++ b/modules/web/doc_classes/HTMLTemplateData.xml @@ -1,8 +1,29 @@ + Stores data for [HTMLTemplate]s. + Stores HTML template data for [HTMLTemplate]s. + It uses a cusom format, which should make it easy to edit. Create files using the [code].phtpl[/code] (Pandemonium HTML Template) file extenstion, the editor will import those files as this class. Double clicking on them will directly open them in the Text Editor (if available). + The [code].phtpl[/code] file format looks a bit similar to config files, except it's a lot simpler. For example: + [code] + + [ Head ] + + ... Head html here + + [ Content ] + + ... Content html here + + [ Shell ] + + ... Shell html here + + [/code] + This file will be parsed as 3 key-value template strings. A key named [code]Head[/code] with the content [code]... Head html here[/code], a key named [code]Content[/code] with the content [code]... Content html here[/code] and a key named [code]Shell[/code] with the content [code]... Shell html here[/code]. + Note: Make sure there is no whitespace before and after the square brackets of the section keys. Also note that white space will be stripped on both sides of the keys before storing them. @@ -10,47 +31,55 @@ + Clears all data. + Gets the template string for the given name and returns it, or it returns an empty String if not found. + Checks whether the template string for the given name is available. + Loads data from a file using the [code].phtpl[/code] file format. + Loads data from a string using the [code].phtpl[/code] file format. + Removes a set key value pair. + Saves data to a string using the [code].phtpl[/code] file format. + Saves data to a file using the [code].phtpl[/code] file format. @@ -58,11 +87,13 @@ + Sets a template key value pair. + Returns att stored templates as a Dictionary.