Please note that you may have been redirected (you might like to make a note of the URL in the address bar of your browser and update accordingly) This is a permanent archvie but is no longer actively maintained. Please visit http://joshuaink.com for the latest updates.

Rebuild day 3 point 5

Sunday October 24, 2004

With my clean URL's in place I can start to build up my site sections and I will need to provide some navigation for these sections. There is a textpattern tag which goes: <txp:section_list /> and this will spit out a list of all sections on the site alphabetically but I want a bit more control. Last time I hard-wired a navigation list in place, this time I did a bit of searching and found a nice section menu plug-in by greenrift.

Before you activate the plug-in you will need to download his mdp-lib file which you will need to rename from mdp_lib.txt to mdp_lib.php and then pop this file in the "lib" folder within the textpattern folder on your server.

Download the plug-in (Note: if you are using anything other than Internet Explorer do a Right Click > Save Link As, otherwise you will get some weird code in the browser window) and once you have uploaded it via Admin > Plugins you will need to activate it - To the right of the plug-ins list you will see an "Active" heading with the word "no" under it, click "no" and this will active the plug-in.

Instructions are a little sparse with this plug-in, to get the list working I included the following in my default page XHTML, found in Presentation > Pages:

  1. <txp:mdp_sectionmenu noshow="mac,article" />

What this has done is produced a list of all sections on the site thus far but I have chosen to hide "mac" and "article". A note of caution, make sure there are no spaces between the commas in "noshow" else it won't work.

If you return to the plug-ins section and click on "mdp_sectionmenu" there is a list of options shown below the source code. Whilst we are here we are going to do a wee bit of tinkering!

By default this plug-in wraps the text within the list in a <span> tag, which I find a bit old hat, so I want to get rid of that. I am no PHP guru so I just played with stuff until the span tag vanished, I changed this:

  1. if(! in_array($sect,$noshow)) {
  2. $content = tag(ucwords($sectionname),'span');
  3. $link = tag($content,'a',implode('',$tagatts));
  4. $out[] = ($atts['break'] != 'br') ? tag($link,$atts['break']) : $link.'<br />';
  5. }

to this:

  1. if(! in_array($sect,$noshow)) {
  2. $content = $sectionname;
  3. $link = tag($content,'a',implode('',$tagatts));
  4. $out[] = ($atts['break'] != 'br') ? tag($link,$atts['break']) : $link.'<br />';
  5. }

Update: Please read the authors comments regarding this hack.

Bingo, no more span tag but each list item retains it's unique ID allowing for some trickery later on. Now I am ready to start building up my sections, another cup of coffee first I think!

  1. Rob Mientjes

    2147 days ago

    This all is very promising. Though the white somewhat puts me off :P
  2. John Oxton

    2147 days ago

    Well Rob, let me save you from any further disappointment, this site is very likely to stay white, though hopefully with a little more style ;)
  3. Angad

    2146 days ago

    I’m starting to get why you did this.
    Great stuff, keep at it!
  4. Marshall

    2142 days ago

    The section names are wrapped in a span tag because some image replacement tags require it. It’s basically just to allow greater control through CSS.