Adding MODx Tags
[MODx Tags] are the unique elements that will add content and functionality to your web pages. You can insert [MODx Tags] anywhere in your template or document's content where you want the tag's content or functionality to appear.
In the template basics article, we saw a very basic template that didn't do much. Let's add a few [MODx Tags] to it and see it come alive.
Internal MODx Tags
This document will focus on using internal [MODx Tags]. For more specific information on these tags, see the section "MODx Tags".
To begin with, we can personalize the page's title with our site's name and the name of the page:
<title>[(site_name)] - [*pagetitle*]</title>
These tags in the head of your template will display something like "MODx Content Management System - Adding MODx Tags" in the title bar of the browser.
The "site_name" is taken from the name that was configured for your site in the System Configuration menu. The "pagetitle" is the Title you gave the document when you created it.
The next thing we want to do is have the document's content appear in the main part of our page. Add the
[*content*]
tag where the content should appear:
<div id="content"> <h1>[*longtitle*]</h1> [*content*] </div>
You will also see that the "longtitle" was added before the "content", so every page will have a customized subheading. The "longtitle" is taken from the Long Title field when you created the document. The "content" is the text you entered in the Document content editor when you created the document.
And finally, in the footer, you may want to have your site's name and email address:
<div id="footer">Copyright © <a href="mailto:[(emailsender)]">[(site_name)]</a> 2005</div>
Both of these values are taken from the database and were set in the System Configuration menu.
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).