I’ve been tinkering a bit with the site here- getting into adding new MovableType templates and moving commonly used code pieces into modules, but more or less, this is mild hacking away until it works.

The additions include some new categories:
* MLX – about the Maricopa Learning eXchange)
* RSS – all the stuff posted about using RSS and the experiments we have done around here
* Using MovableType tips and other things we learn along the way.

All categories, of course, have their own RSS feeds.

This was in tandem with moving the top navigation from a series of horizontally spreading links, to a drop down menu navigation for going to the categories. This in turn led to adding more pieces, and some of these in turn caused even more dribbles of changes…

These changes led to changing my category template to output the category archives as .php files rather than .html (if I was doing the blog all over, I would make ALL files .php which allows for much more customization, but I am already trapped by my first foray into MT).

The new navigation bar on the main page (.html) uses a navigation bar that is included by puting the code as a “new module” named navcat and then referencing it in the template as:

<$MTInclude module="navcat"$>

This gets to be effective as I use the same code in the individual entry template, and thus if I need to change the navigation code, I just edit the module. Re-usable=good.

Building the menu here is easy:

<form method="post" action="/alan/go.php" style="display:inline">
<select name="where" id="gomenu" onChange="submit()">
<option value="">select category...</option>
  <MTCategories>
  <option value="/alan/archives/pcat_<$MTCategoryLabel dirify="1"$>.php"><$MTCategoryLabel$></option>
  </MTCategories>
</select> <input type="submit" value="go dog go!">
</form>

so it simply walsk the categories in my blog to build the menu, and thus stays up to date as I add/delete categories. Making the menu work requires a simple PHP script (go.php) to take the selected archive and refer the browser there:


<?php
// default for empty query
if (!$where) $where = "/alan/";
//else go to desired location
header ("Location:$where");
?>

Now the last tricky part was getting the navigation menu on the category archive to make sure it selected itself for the current menu option (if we are viewing the “RSS” category, this should be the selected menu item). Now this is where PHP adds some punch to MT- it is simply a matter of testing the current PHP page name if it is the same as the category links we are cycling through, and if so, we add the “selected” text to the HTML menu:


<form method="post" action="/alan/go.php" style="display:inline">
<select name="where" id="gomenu" onChange="submit()">
<option value="">select category...</option>
  <MTCategories>
  <option value="/alan/archives/pcat_<$MTCategoryLabel dirify="1"$>.php"<?php
    if (basename($PHP_SELF) == "morecat_<$MTCategoryLabel dirify="1"$>.php") {
      echo " selected";
    } ?>>
    <$MTCategoryLabel$></option>
  </MTCategories>
</select> <input type="submit" value="go dog go!">
</form>

Note also I have added the search form to the top area rather than where it has been pushed down on the right side panel- using two forms side by side in the template was the simple matter of inserting the insline style declaration in the <form> tag:


&lt;form method="post" action="....." style="display:inline"&gt;

The post "Some Changes around the CDB dog house" was originally slapped on the butt by a cigar smoking doctor yelling "It's a post!" at CogDogBlog (http://cogdogblog.com/2003/09/some-changes/) on September 7, 2003.

1 Comment