Pagemaster » Plugin to display categories in a "collapsible" tree-like menu

screenshots

Information

Below is some code to create a collapsible tree-like menu based on the code from the catbrowser plugin.

Demo: http://www.cityweaver.com

credits: billguy

Installation

Download the catbrowser plugin on this site and adapt it like below.

Code Snippets

I'm using the catbrowser plugin b/c I like having the pub. count in my categories. I'm using it like so:

Code

<!--[pagesetter_CatBrowser additionalvars="orderby=lastname:asc" field="category" listClass="kb1" showcount="yes" trim="no"]-->
I modified _CatBrowser.php like so:

Code

function pagesetter_CatBrowser_rec(&$items, &$i, $indent, $size, &$url_parameters, &$setup)
    {
       if (isset($setup['listClass'])  &&  $i == 0)
        // $html = "<ul class="\"$setup[listClass]\"">\n";
     $html = "<select name="\"catid\"" class="\"pn-text\""><option value="\"Select\"">Select</option>\n";
      else
      $html = "
<ul>\n";
..then a little further down:

Code

$url = pnModUrl('pagesetter', 'user', '', $url_parameters);
if ($setup['currentValue'] == $item['id'])
//$html .= "<li><span class="\"current\""><a>$item[title]</a></span>\n";
$html .= "<option title="\"$item[title]\"" value="\"$url&orderby=lastname:asc\"">$item[title]</option>\n";
else
// $html .= "
<a>$item[title]</a>\n";
$html .= "
<option title="\"$item[title]\"" value="\"$url&orderby=lastname:asc\"">$item[title]</option>\n";
}
Pretty simple fix. I'd still like to have a way to distinguish sub-categories instead of having one big colossal drop down box. Check out how http://cityweaver.com/index.php was done to get an idea of what I mean. Later!</select>
Only logged in users are allowed to comment. register/log in