|
by Leo A. Notenboom |
Remember that the goal of the templates is simply to transform your content into your desired results - normally HTML pages for display.
When dealing with templates, it's easy to think that you have to do everything using MT's constructs and easier still to get stuck into the rut of using only the examples or variations of the default templates.
Take the category list, for example. The most common category list is generated as follows:
<MTArchiveList archive_type="Category">
<a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a><br/>
</MTArchiveList>
Which generates a list of all your categories, that are clickable to get to their corresponding archives. On Ask Leo! the result would begin like this:
Administration
General Computing
Hardware
Instant Messaging
and so on...
Since I have a lot of categories, it can take up a fair amount of the page's real-estate. For a time I decided to use a drop-down list. Quite easily done with the following template fragment:
<select onchange="window.location.href = this.value;">
<option value="/" SELECTED>Select...</option>
<option value="/archives.html">The Full Archive</option>
<MTArchiveList archive_type="Category">
<option value="<$MTArchiveLink$>"><$MTArchiveTitle$></option>
</MTArchiveList>
</select><br/>
Here's the old "Administration" category archive page:
Note the dropdown list on the right. Here it is again, with the list opened:
If you go back and look at the template fragment, you can see that the items "Select..." and "The Full Archive" are manual, hard coded entries in the list, but the rest of the dropdown is created when MT processes the template and builds the HTML output.
This is just an example. The true "tip" here is to use your knowledge and familiarity with HTML to look outside of the default templates.
Posted June 24, 2006
Site Map
Entire site Copyright © 2003-2008,
Puget Sound Software, LLC and Leo A. Notenboom
Terms, Conditions & Privacy