Enter your email address:

Delivered by FeedBurner


Sign up to receive a reply:

Powered by MT-Notifier

user-pic

Templates 101 : core concepts behind creating customized templates

Vote 0 Votes

UThink Blog Support (uthink@umn.edu) is the only resource on campus that helps students with UThink, and we do not go extensively into customizing templates. The possibilities for customization seem endless, the time it would take to help each person is disproportionate, and there are risks involved. The farther your templates deviate from the original code, the more likely you are to introduce code that undermines how basic UThink functions work, like authenticating and commenting.

That said, the best learning tool out there is the Movable Type Template Tag Reference:
http://www.movabletype.org/documentation/appendices/tags/
Everything I know I learned from that page and trial/error.

The basic concept that you need to understand is that a Movable Type template tag uses a hybrid of traditional languages (HTML, CSS, etc) and the Movable Type language. There seem to be two types of Movable Type tags in the language: container tags and display tags. Container tags simply set a context for the display tags, the ones that actually generate something that gets displayed. Here's an example:


<mt:Entries>
</mt:Entries>

By themselves, these two container tags do nothing. All it says is "open up the entries table and run through all of the entries on this blog." But now I'll add something in between.


<mt:Entries>
<$mt:EntryTitle$><br />
</mt:Entries>


Notice how there are dollar signs on the inside of the brackets. That's what indicates that it actually displays something. So now, it says, "open up the entries table and run through all of the entries on this blog. At each entry, display the title of the entry, followed by a break tag." So on the public side of your blog, you get something like this:

10/24 - Today's Blog Entry
10/23 - Today's Blog Entry
10/22 - Today's Blog Entry

You can do the same thing with other types of data in your blog, like the names of authors:


<ul>
<mt:Authors>
<li><$mt:AuthorDisplayName$></li>
</mt:Authors>
</li>
</ul>


This would make a bulleted list of all of the names of your authors. You could even make a table:


<table>
<th>Name</th><th>Entries Written</th>
<mt:Authors>
<tr><td><$mt:AuthorDisplayName$></td>
<td>
<mt:AuthorName setvar="usernamevar">
<mt:Entries author="$usernamevar">
<a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a>
</mt:Entries>
</td>
</tr>
</mt:Authors>
</table>

This is a table that displays the name of each author on the left side and links to all of his or her entries on the right side. I had to use a new concept in order to do that: variables. On the seventh line, I only wanted to show entries of one author. But since the code I've written moves through each author, I couldn't simply say, "". The name needed to be allowed to be variable. So, each time UThink calls up an author, the variable $usernamevar gets reset to the current author's username (not their display name). This is definitely an advanced topic.

With these basics, plus the Template Tag Reference, you can build lots of great index pages, like an author archive page, a page for instructors to keep up on their students' work, or RSS feeds by category. You can also create custom widgets for your sidebar.

Good luck!

Add a Reply

Forum Groups

Classic Blogs and General Info

29 42

Last Topic: Can I use PHP code in my blog? by Charlie Heinz on Jan 9, 2012

Discussions

Q&A

Be the first to post a topic in this forum

Blogging Principles

Be the first to post a topic in this forum

Other Template Sets

Community Blogs

Be the first to post a topic in this forum

Community Forums

Be the first to post a topic in this forum

Widget Marketplace