Pages and Templates: Difference between revisions
Line 10: | Line 10: | ||
=Templates= | =Templates= | ||
Each page instance is assigned a template which is an instance of I2CE_TemplateMeister, and usually an instance of the sub-class I2CE_Template. | |||
==Template Data== | ==Template Data== | ||
The module ''template-data'' provides the ability to assign arbitrary data to any node in the DOM. The data exists in categories, such as 'FORM' or 'OPTION' and applies to all sub-nodes of the given node. Each piece of data is assigned a name. | The module ''template-data'' provides the ability to assign arbitrary data to any node in the DOM. The data exists in categories, such as 'FORM' or 'OPTION' and applies to all sub-nodes of the given node. Each piece of data is assigned a name. | ||
Line 20: | Line 21: | ||
There are several modules which make explicit use of the template data structure. | There are several modules which make explicit use of the template data structure. | ||
<span style='color:red'>Warning:</span> The template data mechanism assumes that there is only one template in use per request. Be very careful if you are using multiple templates in one page each making use of template data. | |||
===Display Data=== | ===Display Data=== | ||
===Options=== | ===Options=== |
Revision as of 16:09, 12 March 2009
Pages
Page Classes
The action() method
Variable Conversion
Wrangler
Converting a URL to a Page
Page Styles
Templates
Each page instance is assigned a template which is an instance of I2CE_TemplateMeister, and usually an instance of the sub-class I2CE_Template.
Template Data
The module template-data provides the ability to assign arbitrary data to any node in the DOM. The data exists in categories, such as 'FORM' or 'OPTION' and applies to all sub-nodes of the given node. Each piece of data is assigned a name.
If the node is an given by specifying an id (rather than giving an explict instanceof DOMNode) the data will be held in a cache until a node with the given id is added to the template.
When looking for a piece of data assigned to a particular node, we start at the given node and walk up the DOM until the named data is found.
For each category of template data, a default bit of data may be assigned which applies for the whole DOM.
There are several modules which make explicit use of the template data structure.
Warning: The template data mechanism assumes that there is only one template in use per request. Be very careful if you are using multiple templates in one page each making use of template data.
Display Data
Options
Closely related to the Display Data module is the Options module which saves template data in the category 'OPTIONS.' It process tags of the form:
<select id='some_id'/>
and if it finds an OPTION template data named 'some_id' it will append a <select> tag for each of these bits of data.
Form Data
A form can be set on any node and can be referenced as
<span type='form' name='form:field'/>
where you would substitute 'form' and 'field' as appropriate. If the 'form' is not specified it uses the default form, if any, set for the page.