Cooking with Webstandards! Taste the full flavour of the Web

Next entry: H121: The Week 4 Review | Previous entry: H121: The Week 3 Review

H121: More Template changing and Skinning

This whole blog affair kept me really busy throughout the whole week. I had to create several new templates, gather content for the "outside-static" non blog pages (like Head-Cook, Reference and Policies), create some additional artwork as well as adding styles to the main CSS file. So here's a short outline of what I've done this week, to make this blog GO!

  1. Refine all template to my personal needs. Since this weblog is marked up as XHTML 1.0 Strict I am going to serve it as application/xhtml+xml to browsers that can handle this MIME-Type. Therefore I included a PHP Snippet that sniffs the browsers HTTP-Accept header.

    So far so good. I've done this several times before, so I know it works out quite well. But now every comment that you are going to leave has to be well-formed. For example, an unescaped ampersand in a comment makes the whole page break when parsed with a XML engine. So I have to care about comment validation. I am still striving for solutions but haven't come up yet with something satisfying. So be careful with your comments for now ;)

  2. I implemented categories. To make them display and link to them, I created two category archive templates. One generic archive, where all categories are listed and its description is given. And then a category archive, where all entries of a specific category are listed, for example the Cooking School Archive.

    Did the same thing for the monthly archives. I found out that if you want to change the look and feel of the monthly archives page, you had to change the Database Archive template. There's one problem left though. It seems to be, that the Recent Recipes (Recent Entries) displayed are dependend on the archive page you are looking at. When browsing to a category archive it suddenly lists all the recent entries of this specific archive, but not the "real" recent entries. I am sure there's a workaround for it, but haven't found out yet. Any pointers would be appreciated.

  3. Making use of Movable Type (MT) Includes. Some repeating elements of this site like the navigation and the search are actually a pain in the arse if you have them in every template. Change one link in the navigation bar and you have to do so in every template the navigation appears. So I sourced them out using the MT Template Module function. This actually works like Server-side Includes. Build a template module including the whole navigation bar's markup. In every template I want the navigation bar to appear, I had to use this special MT Variable: <$MTInclude module="name_of_template_module"$>. Yeah, works like a charm. Now, if I want to change something in my navigation bar, I just have to change the Template module I created for it.

  4. Customizing the search results page. This one was difficult to find. I had to dig in the MT help file to learn that the search templates are not managed by the MT Template system. You have to create your own .templ file for it. I took the existing default.templ file as a starting point. It is found in the MT installation path /cgi-bin/search_templates/. Now you can tweak this template to fit your needs, give it a name let's say customsearch.templ and load it up into the same directory.

    In order to let MT know which template to use when displaying the search results, you have to do two things. Change MT's config file mt.cfg (found in the installation path as well) and add the following line to your AltTemplate Settings:
    AltTemplate customsearch customsearch.templ.

    That's it. Upload the altered version of mt.cfg. Last thing you have to do is tell the form you use to trigger the search which template to use as well. This is done by adding a hidden input field:
    <input type="hidden" name="Template" value="customsearch" />.

    Et voilà, you're done.

  5. Fine tuned the Recent Recipe links. I am aware that the headings of the entries that are displayed as links for the Recent Recipes aren't always helpful. So I added the title attribute to these anchor elements. I chose the Entry Excerpt to be displayed as title (most browsers pop up with a tooltip while you are hovering over these links, just give it a try). So I used the following markup:
    <a href="<$MTEntryPermalink$>" title="<MTEntryExcerpt>"><$MTEntryTitle$></a>.

  6. Permanent links to comments. I wanted to do this, in order to make comment linking possible. You can now point to a specific comment. I took benefit from the MTCommentID tag. So I used this tag within the comments template, like so:
    <div class="commentsbody" id="c<MTCommentID>">
    <a href="<$MTEntryPermalink$>#c<MTCommentID>" title="Permalink to this comment">Let Cool</a>

    Note that I included the letter c, because MTCommentIDs are actually numbers, but starting an HTML id attribute with a number is not valid.

Well, that's all for today, I am sure I did a lot of other things, but these one were worth mentioning I thought. So, thanks for reading it :)))

Posted by Minz Meyer at April 09, 2004, 05:35 PM | To Top

Other ingredients

Hmmmmm.....I see that I'm going to have to do a LOT of reading and working to get even half as far with blog as you have!

It is looking great, and seems to get even better, if possible, all the time.

Posted by: Christine at April 10, 2004 11:40 AM | Let Cool (this ingredient)

I have a question. I don't know how difficult it might be to download MT (or upload) to my server. Would I be better off taking the "high road" and just paying the money for TypePad? Any suggestions or comments?

I think I do so/so in MT but TypePad seems as if it would support the photos which I am more inclined to want to use.


Posted by: kathy painter at April 13, 2004 12:07 AM | Let Cool (this ingredient)