Heal Your Church WebSite

Teaching, rebuking, correcting & training in righteous web design.

A little advice for a Friend

Joe Friend asks:

I’m interested in how you’re doing the church site in MT. Where is the
content? Is it in entries? If so how do you get a specific entry to show up
in a specific page? If not, where’s the content?

I have a designer working on redoing a Frontpage site for me in MT. She put
all the content in templates. I really hate this solution. But I thought it
you knew MT tags well enough to have come up with an alternative, then I’d
bug you for it! ;-)

What Joe is talking about is the Redland Rewrite, and what I think he wants to know is where the templates end and the dynamic content begins. I know this is a bit more MT specific than I usually like to get, but hopefully I can explain SOME OF IT it in a way that is applicable to whatever html editor or content manglement system you prefer to shoot yourself in the foot with.

First, let’s make sure we’re all on the same page, in this case, I’m going to ask you to cruise on over to the Calendar of Events page as I’ll refer to it as an example of what I’m doing here … I’ll wait.

Second, you need to understand a little bit on how MovableType (MT) renders pages. MT is written in Perl. Unlike PHP, Perl is not embedded into a document. Instead, you make entries, press the save and/or rebuild button and individual pages are created. This means EVERYTHING is run through your template, compelling content included. Though we enter the content via the entry screen without the encumberance or annoyance of seeing all the template taggery.

This has the disadvantage that pages aren’t all “on-the-fly” like pMachine, which uses PHP. However, it does have the bandwidth advantage of static pages. Morever, you can save/build pages in MT as PHP documents, instead of HTML. I chose to do this as it adds a rather large power drill to my toolbox.

Okay, on the top left corner of the Calendar of Events page, there is an image. If you view the source of the page, you’ll see it is named “section_events.jpg.” As you might have guessed, the category name is being generated in the page template.

#header {
background: #6666FF url(“<$MTBlogRelativeURL$>graphics/section_<$MTEntryCategory dirify=”1″$>.jpg”) no-repeat left;

That scripture link at the center of the top of the page is also built into the template, but I cheat. You see, I needed to put the Scripture that is associated with in a portion of the template that is outside of entry (the blog content) itself. To do this, I enter to lines into the Keywords field of Movable Type. This field allows you to add stuff yo might put up in meta tags, or what I did is created data that I could parse with PHP and put anywhere on the page I pleased:

   /* assumes lines of data in following format:
      scref=John 3:16
      verse=For God so loved the World
   $keywords = “<$MTEntryKeywords encode_php=”qq”$>”;
   $lines = split(“\n”, $keywords);
   foreach ($lines as $line)
      list($key, $value) = split(“=”, $line);
      $items[$key] = $value;
   echo $items["verse"] …

In fact, using this method, there is other essential information I can use to plug into the page … provided I put this code at the close to the top of my page:

$GLB_catname = trim(“<$MTEntryCategory dirify=”1″$>”);
$GLB_category = trim(“<$MTEntryCategory encode_html=”0″$>”);

$GLB_entname = trim(<$MTEntryTitle dirify=”1″$>);

The trick is in using various MT tag constructs, such as “dirify” which turns entry and category names into valid file names/paths. I can then use these $GLoBal values anywhere else in the page I need them, such as some more PHP in the template to produce portions of the breadcrumb navigation, and the category navigation menu you see on the left of the page, directly below the breadcrumb navigation.

Also built into the template are portions of the footer. For example, here is how I generate the text menu on the footer of the page:

<MTCategories show_empty=”1″>
<a href=”<$MTCategoryArchiveLink$>”title=”<$MTCategoryDescription$>” ><$MTCategoryLabel$></a>

I use a similar, but much more complicated method of dynamically generating the drop down menu just above the breadcrumb navigation. New entries show up on the menu immediately. However, it does require explicit rebuilds when categories are added.

In fact, only the compelling content of each page is what is actually part of the blog entry/post … well, with the exception of the aforementioned keywords. Technically, it is part of the template … but the church staff doesn’t need to know that. They just need to hit the new or edit entry tag, type in their stuff, hit the save button and go on with their tagless lives. Well, except in the case of the Calendar of Events page … which hooks into a file I create from a nightly cron job … so the blog entry simply reads:

<?php include(“calendarfilename.ext”); ?>

The point here is, regardless of CMS or publishing system, learn the tags of the system. Don’t be afraid to mix and match technologies, such as using PHP for the rendered page. If you do, don’t forget you can take data from the template tags and pass it into the final static page. And most important, think outside the box in how you apply all this to your church’s web site.

One Comment

  1. Thanks for these extremely helpful tips. I’ve been wondering how people use MT for non-blog type stuff and you’ve managed to connect the dots for me.

    Much appreciated.