summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--php/leftbar.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/php/leftbar.php b/php/leftbar.php
index f2eb7bd..080243c 100644
--- a/php/leftbar.php
+++ b/php/leftbar.php
@@ -43,7 +43,7 @@ function LB_LeftHeader($hdr)
function LB_TopLink($url,$txt)
{
- printf('<li class="lb_toplink"><a class="lb_toplink" href="%s">%s</a></li>',$url,$txt);
+ printf('<a class="lb_toplink" href="%s">%s</a>',$url,$txt);
}
function LB_SubLink($url,$txt)
@@ -60,12 +60,20 @@ function LB_OpenLink(&$is_open)
}
}
-function LB_OpenSub(&$is_open)
+function LB_OpenLinkItem(&$is_open)
{
if (!$is_open)
{
$is_open = TRUE;
echo '<li class="lb_toplink">';
+ }
+}
+
+function LB_OpenSub(&$is_open)
+{
+ if (!$is_open)
+ {
+ $is_open = TRUE;
echo '<ul class="lb_sublink">';
}
}
@@ -79,13 +87,21 @@ function LB_CloseLink(&$is_open)
}
}
+function LB_CloseLinkItem(&$is_open)
+{
+ if ($is_open)
+ {
+ $is_open = FALSE;
+ echo '</li>';
+ }
+}
+
function LB_CloseSub(&$is_open)
{
if ($is_open)
{
$is_open = FALSE;
echo '</ul>';
- echo '</li>';
}
}
@@ -103,6 +119,7 @@ function LeftBar($file, $context = '')
$curcontext = '';
$in_link = FALSE;
$in_sub = FALSE;
+ $in_linkitem = FALSE;
while (!feof($fp))
{
@@ -131,6 +148,7 @@ function LeftBar($file, $context = '')
if (count($tok)==2)
{
LB_CloseSub($in_sub);
+ LB_CloseLinkItem($in_linkitem);
LB_CloseLink($in_link);
LB_LeftHeader($tok[1]);
}
@@ -144,7 +162,9 @@ function LeftBar($file, $context = '')
if (count($tok)==3)
{
LB_CloseSub($in_sub);
+ LB_CloseLinkItem($in_linkitem);
LB_OpenLink($in_link);
+ LB_OpenLinkItem($in_linkitem);
$ldef = $links[$tok[1]];
$curcontext = $tok[2];
LB_TopLink($ldef->url,$ldef->text);
@@ -179,6 +199,7 @@ function LeftBar($file, $context = '')
}
LB_CloseSub($in_sub);
+ LB_CloseLinkItem($in_linkitem);
LB_CloseLink($in_link);
fclose($fp);