In Authenteo a component is a persistent object that is an instance of the component template and is capable of dynamically generating HTML. As a component is rendered, all accessed to the persistent properties are recorded to determine dependencies. If any of the persistent objects that the rendering was dependent on change the render process is rerun.
A component can be inserted into any other content or layout as it is autonomous other than its interaction with the context. A component has several important members:
render (context)
This function is called when a component needs to render, that is generate its HTML. This function can be overridden to define any logic needed for rendering. The default implementation takes the styles persistent property and uses it as the css for the component and takes the HTML persistent property and calls the context render Inside function to output and pause the HTML. This is rerun if any persistent objects were used in the rendering.
layout
This contains the (preprocessed) HTML for the component. This may contain tags with logic handlers.
tags
This object contains functions that handle each of the different tag logic definitions. New tag handlers or tag logic definitions can be defined in this object. HTML is parsed by searching for tags that define an attribute ?logic?. The value of the attribute defines the tag logic handler function. For example:
<div logic = ?display? value = ?content.name/>
The tag will call the display tag logic handler. Tag logic handlers may also utilize other attributes. Tag logic handlers can utilize attributes that do an evaluation based on the current context to get a value. In particular, most tag handlers will utilize the value attribute which does evaluation. In the example above the value attributed signified that the tag should display the name of the current content property of the context. This evaluation can handle JavaScript expressions (with persistent property notation support) so it is very powerful.
Tag handlers
display This handler outputs the evaluation of value. This does to a string if necessary or a render if the value is a component. If no value is specified the content property of the context is used.
field attributes: value, assign to this takes the given value (evaluated) and assigns it to the field given by the assign to expression. If no assign to is given then it is assigned to the content of the current context.
e ach attributes: value, assign to this is similar to the field handler except it must have a list for the value and it will iterate through the list and do an assign an insider render for each entry.
hyperlink attributes: value This should be used with an <a> tag. It sets the hyperlink to do navigate to the page given by value.
popupLink attributes: value, event
This sets the on-click event so that when it is triggered a popup will be displayed with given value (as the display handler would show it).
Context
Whenever a tag handler is encountered in the rendering process a new context object is created which inherits from the parent (or containing context). This inheritance enable scoping within the document structure. A variable or property can be assigned to the context by a tag and then all elements within that tags element can access that variable or property from the context. Outside of the enclosing element is then out of scope and unaffected by the assignment.
Several properties are normally used in the context:
content?this generally represents the current content that is being displayed.
component?This is the current component that is rendering.
element?This is the layout element associated with the current context.
p arent?This is the parent or enclosing context.
Authenteo 1.1 is available.
Now with
Firebug integration
. Make changes to CSS and HTML with Firebug and save the changes
Check out press releases and the following articles on Authenteo: