Style Elements

From OpenPSA Wiki

Jump to: navigation, search

Style Elements hold the actual code of a Style. In a Midgard MySQL Database, they are stored in the tables element and element_i and are based on the MgdSchema midgard_element.

[edit] Structure

Style Elements are organized in Styles which form a tree structure. Substyles inherit their parent Style's Elements but can overwrite them. There is a special ROOT Style Element, from which the elements are referenced.

One of each Style's Elements should include a reference to the actual content (usually in this form: <(content)>) to load it from Topics and Articles.

In MidCOM-based Hosts, Styles can also be linked to Topics and two special Style Elements exist which can be used to load Style Elements from any given Style or Substyle, they are called style-init and style-finish.

In regular Midgard, Style Elements can be included from other Elements with the language construct <(elementname)>. If a Page Element with the same name exists, it takes precedence. For more information about inheritance, please refer to Templating in Midgard.

[edit] Usage

Typically, a web page produced by Midard consists of different blocks, for each of which a style Element exists where the layout can be changed. Style Elements often also contain PHP code for modifying the output based on the available variables. On MidCOM-based Hosts, Style Elements can be used to customize the Component's output. For information, please refer to Templating in MidCOM.

Personal tools