Template commands - TuTech/DasCMS GitHub Wiki

CMS Template Commands

All commands have to be assigned to the template namespace to be executed http://www.bambuscms.org/2008/TemplateXML

Via direct xmlns

<foo xmlns="http://www.bambuscms.org/2008/TemplateXML" />

Via indirect xmlns

<bar xmlns="http://www.bambuscms.org/2008/TemplateXML">
    <foo />
</bar>

Via prefix

<cms:bar xmlns:cms="http://www.bambuscms.org/2008/TemplateXML">
    <cms:foo />
</cms:bar>

Content

Show one property of one specific content

<content alias="demo-2011-02-25" property="Title" />
  • alias the content's id or alias
  • property the content's property such as "Title"

Controller

Call a function from from an template-supporting object referenced by a guid

<controller guid="de.tutech.events" call="test">
    <param name="namedParameter" value="testing" /> 
</controller>
  • guid references the class by it's GUID constant
  • call call a function if the object permits it

Env

Get a value from the template env

<env get="stuff" />
  • get the name of the value to get

Head

deprecated Render the html-head element

<head />

Html

deprecated Render the html-wrapping tags with proper doctype declaration

<html lang="en" doctype="html4"></html>
  • lang the language code for this page
  • doctype the name of the doctype to use

Runtime

Get a value from the current runtime array

<runtime get="stuff" />
  • get the name of the value to get

Scheduler

Let the cms run tasks async the e.g. (de-)publicise contents

<scheduler interval="10000" />
  • interval the time between calls in milli seconds

Site

Render html, head and body tags with proper doctype declaration, automatic css and script loading. Recommended template root element

<site>...</site>

Stats

Displays run-time, mem-usage and ip address in hex

<stats />

Text

Displays the given text. Can be used to generate create tags with dynamic attributes

<text value="text" />
<text value="&lt;div class=&quot;" />
    dynamic element
<text value="&quot;&gt;" />
    stuff in dynamic div
<text value="&lt/div;&gt;" />
  • value the text to display

Treenavigation

Embed a Treenavigation

<treenavigation show="navi" />
  • show the name of the navigation to show here

URL

Get a URL parameter E.g. in a call like index.php?page=foo this would return foo

<url get="page" />
  • get the name of the parameter to show here

View

The main element to display cms content

Embed content

<view for="page" show="content" />

Embed preview image

<view for="page" show="previewimage" width="100" height="50" scale="1c" />

Embed something defined by a formatter

<view for="page" show="formatter" use="my_content_formatter" />
  • for the name of the url to get the alias from
  • show what property of the content we want to display [1]
  • width if the content is sizeable like an image set the width to render it
  • height if the content is sizeable like an image set the height to render it
  • scale set the scale method for scaleable content [2]
  • color set the background color if the content is stainable like some scaled images
  • use use a formatter with the name here
  • fixcontent force this field to diaplay always the same content identified by an alias

Things that can appear in a view

  1. Properties
    • content (view)
    • description (view)
    • title (view)
    • subtitle (view)
    • pubdate (view) the pubdate in the format set in the config
    • author (view)
    • tags (view) the tags as csv-string
    • previewimage (view, width, height, scale, color)
    • type (view) the contents class name
    • property (view, use) any named property of the content (title, subTitle, createdBy, ...)
    • formatter (view, use) use a formatter to display content here
  2. Scale options
    • 'aspect_fit'
    • 'aspect_crop'
    • 'aspect_fill'
    • 'stretch'
⚠️ **GitHub.com Fallback** ⚠️