0

The Template Tagging System

OmCore's template system allows extra functionality, such as navigation menus, breadcrumb trails, and custom content, to be added to your website by placing tags within the HTML structure of the template file (default.php). Tags consist of text encapsulated within square brackets, e.g. {{ navigation }} which are replaced by HTML output when the website is generated.

Tag attributes

Some tags accept attributes which alter the tags HTML output. Attributes use the following format name="value".

[logo src="/assets/templates/my-template/images/logo.gif"]

Required attributes

Some tags have attributes which must be specified for them to function properly. For example, the [logo] tag must have a src attribute specified so that the CMS knows the location of the image to be displayed.

Attribute catch all

Some tags will except any attribute. Whatever is specified will be inserted into a fixed place within the HTML output. For example, the logo tag will place any additional attributes specified within the <a> element that encapsulates the logo's <img alt=""> element.

Available tags

[content]

Use this tag to place the page's content into your site. Page content is grouped into content areas. The content of each area is loaded in their set display order and placed within an area container div. Each content area div is inset with an 'inner' div to help with layout.

DISPLAYING CONTENT AREAS' CONTENT INDIVIDUALLY

For cleaner markup, and greater control, the area attribute can be used to only load the content from the specified content area. If this attribute is used then no container or inner div is used and only the content of the content area is output.

USING A COMBINATION OF CONTENT TAGS WITH AND WITHOUT THE AREA ATTRIBUTE

If the area attribute has already been specified for a particular area then if the [content] tag is used on its own only the remaining content areas are output. For example, on a page with 4 content areas, if [content area="1"] and [content area="2"] where placed in the template then [content] would only output content areas 3 and 4.

GLOBAL CONTENT

The content tag also accepts a content_id attribute. If used the tag will only output the HTML of the specified content. Content applied this way effectively becomes Global Content hard-coded into the interface so that it appears on every page of the site. To create Global Content simply obtain the content's ID, displayed in the header of the content's update form of the CMS, and add the ID of the attribute to the content tag. For example [content content_id="c1234"] Using Global Content, as opposed to hardcoding HTML into the template file, has the benefit that the content can be managed by the CMS. Tip It is advised to centrally store your global content on a satellite page with a descriptive name such as 'Global content'.

REQUIRED ATTRIBUTES

None

OPTIONAL ATTRIBUTES

  1. area - Sets the tag to only output the content area's content without container divs.
  2. content_id - Sets the tag to output only the HTML of the content with the specified content_id, allowing the creation of Global Content within the interface.

EXAMPLE TAGS

[content] [content area="1"] [content content_id="c1234"]

[logo]

This tag offers a quick and easy way to place the site's logo within the template. It is replaced by an image with the site's name as it's alt tag that links to the site's homepage.

REQUIRED ATTRIBUTES

src - The source of the logo. I.e. /assets/templates/default/images/logo.gif

OPTIONAL ATTRIBUTES

  1. alt - The images alt tag. If not specified then the site's name, as specified within the site's component, will be used appended with 'home page'. I.e. 'My site home page'
  2. href - The URL that the logo's link targets. If not specified then the site's home page, as specified in the site's component, will be used.
  3. Catch all - Additional attributes will be assigned to the < a > element .

[navigation]

This tag places the navigation within the interface. It creates a single tier unordered list of links to pages assigned to the home page's navigation group.

Tip A more advanced method of placing a navigation menu in the interface is by using the [content] tag to target a Navigation menu content type. See Global content above. This technique is required for creating dropdown menus. For more information see the Guide to navigation menus.

REQUIRED ATTRIBUTES

None

OPTIONAL ATTRIBUTES

  1. group - Sets which page group to load the pages from
  2. levels - Sets how many sub-levels of pages to load.
  3. url_class_names - Assigns every list element with its URL as a class name.
  4. Catch all - All attributes will be assigned to the list's < ul > element.

EXAMPLE TAG

navigation group="Primary navigation" levels="1" url_class_names="1"

[breadcrumbs]

Creates a breadcrumb trail, a navigation men used to present the user with their location within the site's heirarchy.

REQUIRED ATTRIBUTES

None

OPTIONAL ATTRIBUTES

None

0 comments

Post is closed for comments.