Page Templates

Textstem pages are generated using "page templates".

Page Templates are stored in the /textstem/Application/Views directory, and can be over-ridden by files in the /twigstem/themes/[THEME]/Views directory.

Notes For Template Designers

Template Tags

Most templates

Page Regions

Most templates will have page regions (regions where components are attached to the page). They may also have template regions. Components attached to templates via the template region will be rendered whenever the template is used.

To create a page region, the special wrangler tag is used

To create a template region, the special wrangler template tag is used

To make the Textstem Admin UI aware of these regions (and to enable an interface for authors to attach componets to these regions), templates should declare the available regions

$regions = array(
$tplregions = array(

If the regions are not explicitly declared in the template, then textstem will attempt to extract the regions (which may not always work with complex templates)

Page Context

When building a page, the "page context" is populated with values. A page template can access these values using the syntax. There are several useful variables, including

  • amdconfig (html markup for AMD configuration)
  • amdconfig_array (array of the configurations - an alternative to the above)
  • current_user_id
  • current_user_level
  • current_user_name
  • theme

For a full list of page variables available for a specific page, use the pageinspector tool.

Designing for Themes

In order to make templates 'theme aware', you can use the variable to switch linked css and javascript. For example

Passing data to the browser

Textstem has 2 basic strategies to facilitate sharing data with

  1. Using the 'AMD Bridge' - a textstem helper which creates the amdconfig page data
  2. Using the 'headinc' and 'footinc' page data