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:
- <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:
- if(! in_array($sect,$noshow)) {
- $content = tag(ucwords($sectionname),'span');
- $link = tag($content,'a',implode('',$tagatts));
- $out[] = ($atts['break'] != 'br') ? tag($link,$atts['break']) : $link.'<br />';
- }
to this:
- if(! in_array($sect,$noshow)) {
- $content = $sectionname;
- $link = tag($content,'a',implode('',$tagatts));
- $out[] = ($atts['break'] != 'br') ? tag($link,$atts['break']) : $link.'<br />';
- }
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!




Rob Mientjes
2147 days ago
John Oxton
2147 days ago
Angad
2146 days ago
Marshall
2142 days ago