Posted by moremojo on Friday, 17.02.2006. Last modified 30.03.2006. Category: pagemaster » codesnipstpl
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"]-->
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";
{
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";
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";
}
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";
}

