Templates
What are Templates?
Templates contain the HTML markup tags that determine the layout and appearance of your site. When a document is requested, MODx gets its template and replaces all the MODx tags in it before sending the finished page off to the user's browser.
Usage
Simply create a new Template, then assign it to a Resource. The Resource's parsed content will then be inserted into the Template.
To create a Template -- Expand the "Content Elements" part of the tree and right click on Templates. Select "Create a New Template."
Here is a sample of a very simple template:
<html> <head> <title>[[*pagetitle]]</title> <meta name="description" content="[[*description]]"/> </head> <body> <h1>[[*longtitle]]</h1> Page ID: [[*id]]<br/> IntroText (Summary): [[*introtext]]<br/> MenuTitle: [[*menutitle]] <hr/> [[*content]] </body> </html>
To assign a Template to a Resource -- When creating or editing a Resource, such as a Document, you can use the drop-down arrow in the "Uses Template" field to select the Template to be used with the document.
Templates can contain any tags, including Template Variables, Chunks, Snippets, and others.
| To display the Resource content, you'll need to make sure to include the [[*content]] tag somewhere in your Template. |