|
From: <sv...@va...> - 2005-03-18 16:03:14
|
Author: de
Date: 2005-03-18 16:03:02 +0000 (Fri, 18 Mar 2005)
New Revision: 88
Modified:
trunk/php/header.php
trunk/php/menu.php
Log:
Tweaked the menu output to stop lonely '|' chars being output
when there's no submenu on that page (hope Ceri is happy now)
Modified: trunk/php/header.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/php/header.php 2005-03-15 02:32:40 UTC (rev 87)
+++ trunk/php/header.php 2005-03-18 16:03:02 UTC (rev 88)
@@ -51,11 +51,11 @@
</td>
<td width=3D"99%" align=3D"center" valign=3D"middle">
<span class=3D"topnav">
- <?php echo $curr_page['top-nav']; ?>
+<?php echo $curr_page['top-nav']; ?>
</span>
- <div class=3D"subnav">
- <?php echo $curr_page['sub-nav']; ?>
- </div>
+ <div class=3D"subnav">
+<?php echo $curr_page['sub-nav']; ?>
+ </div>
</td>
</tr>
<tr>
Modified: trunk/php/menu.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/php/menu.php 2005-03-15 02:32:40 UTC (rev 87)
+++ trunk/php/menu.php 2005-03-18 16:03:02 UTC (rev 88)
@@ -76,14 +76,14 @@
echo ' <li><a href=3D"' .$dir['url'].$files[$i]['url']. '">' .=
$files[$i]['tag']. '</a></li>'."\n";
}
echo ' </ul>'."\n";
- }
+ }
echo ' </div>';
}
=20
=20
/* Called in /php/header.php.=20
Takes as input $_SERVER['SCRIPT_NAME'], eg. /info/contact.html
- Returns the current page title,=20
+ Returns the current page title,=20
and generates the top + sub nav bars for leaf pages.
When a top nav bar item is clicked on,=20
the first leaf page in the list is shown by default. */
@@ -95,56 +95,61 @@
$curr_page =3D array();
$curr_page['title'] =3D 'Valgrind';
=20
- /* if we are on the home page, just return the page title */
- if ( $url =3D=3D '/' || $url =3D=3D '/index.html' ) {
+ /* if we are on the home page, just return the page title */
+ if ( $url =3D=3D '/' || $url =3D=3D '/index.html' ) {
$curr_page['title'] .=3D ' Home';
- } else {
+ } else {
=20
$curr_page['top-nav'] =3D '';
- $curr_page['sub-nav'] =3D " | ";
- $elems =3D explode( "/", $url );
+ // $curr_page['sub-nav'] =3D " | ";
+ $curr_page['sub-nav'] =3D '';
+ $elems =3D explode( "/", $url );
//myLog( $elems );
=20
- global $vgdirs;
- foreach( $vgdirs as $dir ) {
+ global $vgdirs;
+ foreach( $vgdirs as $dir ) {
=20
- /* top nav bar: if this is _not_ the currently selected
+ /* top nav bar: if this is _not_ the currently selected
dir, just make a link. */
- if ( $dir['url'] !=3D '/'.$elems[1].'/' ) {
- $top_nav =3D '<a class=3D"crumb" href=3D"' .$dir['url']. '">' .$dir[=
'tag']. '</a>';
+ if ( $dir['url'] !=3D '/'.$elems[1].'/' ) {
+ $top_nav =3D ' <a class=3D"crumb" href=3D"' .$dir['url']. '">'=
.$dir['tag']. '</a>';
=20
- } else {
- /* otherwise, show it in bold, and list the leaf pages */
- $top_nav =3D '<span class=3D"crumb"><b>' .$dir['tag']. '</b></span>'=
;
+ } else {
+ /* otherwise, show it in bold, and list the leaf pages */
+ $top_nav =3D ' <span class=3D"crumb"><b>' .$dir['tag']. '</b><=
/span>';
=20
- $files =3D $dir['files'];
+ $files =3D $dir['files'];
=20
- /* if user has clicked on a top-nav link, show the first
+ /* if user has clicked on a top-nav link, show the first
leaf page in the list as the default */
- if ( $elems[2] =3D=3D '' ) {
- $elems[2] =3D $files[0]['url'];
- //myLog( $elems );
- }
+ if ( $elems[2] =3D=3D '' ) {
+ $elems[2] =3D $files[0]['url'];
+ //myLog( $elems );
+ }
=20
- for ( $i=3D0; $i<sizeof($files); $i++ ) {
- /* if this is the requested page, show it in bold in
+ for ( $i=3D0; $i<sizeof($files); $i++ ) {
+ /* if this is the requested page, show it in bold in
the sub nav list, and get the page title */
- if ( $files[$i]['url'] =3D=3D $elems[2] ) {
- $curr_page['title'] .=3D ': ' .$files[$i]['tag'];
- $curr_page['sub-nav'] .=3D '<span class=3D"crumb"><b>'.$files[$i][=
'tag']."</b></span>\n";
- } else {
- /* else, just show it as a link */
- $curr_page['sub-nav'] .=3D '<a class=3D"crumb" href=3D"'.$dir['url=
'].$files[$i]['url'].'">' .$files[$i]['tag']. "</a>\n";
- }
- $curr_page['sub-nav'] .=3D " | ";
+ if ( $files[$i]['url'] =3D=3D $elems[2] ) {
+ $curr_page['title'] .=3D ': ' .$files[$i]['tag'];
+ $curr_page['sub-nav'] .=3D '<span class=3D"crumb"><b>'.$file=
s[$i]['tag']."</b></span>\n";
+ } else {
+ /* else, just show it as a link */
+ $curr_page['sub-nav'] .=3D '<a class=3D"crumb" href=3D"'.$di=
r['url'].$files[$i]['url'].'">' .$files[$i]['tag']. "</a>\n";
+ }
+ $curr_page['sub-nav'] .=3D " | ";
+ }
+ if ( $curr_page['sub-nav'] !=3D '' ) {
+ $curr_page['sub-nav'] =3D ' | ' .$curr_page['sub-nav']. "\n";
}
- }
- $curr_page['top-nav'] .=3D $top_nav. "\n";
- }
=20
- } /* end else */
+ }
+ $curr_page['top-nav'] .=3D $top_nav. "\n";
+ }
=20
- return $curr_page;
+ } /* end else */
+
+ return $curr_page;
}
=20
=20
|