[29098] trunk/www/includes/header.inc

source_changes at macosforge.org source_changes at macosforge.org
Fri Sep 14 19:25:12 PDT 2007


Revision: 29098
          http://trac.macosforge.org/projects/macports/changeset/29098
Author:   jmpp at macports.org
Date:     2007-09-14 19:25:11 -0700 (Fri, 14 Sep 2007)

Log Message:
-----------

Turn the shortcuts section of the sidebar into a php array, just as the section above it.
Also use basename() when checking $PHP_SELF against $url to determine the "selected" class.

Modified Paths:
--------------
    trunk/www/includes/header.inc

Modified: trunk/www/includes/header.inc
===================================================================
--- trunk/www/includes/header.inc	2007-09-15 00:39:44 UTC (rev 29097)
+++ trunk/www/includes/header.inc	2007-09-15 02:25:11 UTC (rev 29098)
@@ -1,5 +1,6 @@
 <?php
 /* $Id$ */
+$PHP_SELF = $_SERVER['PHP_SELF'];
 global $mp_version_major, $trac_url, $svn_url, $downloads;
 ?>
 
@@ -22,17 +23,15 @@
         <dd>
             <ul>
 <?php
-                $PHP_SELF = $_SERVER['PHP_SELF'];
                 $pages = array (
                     'Home' => 'index.php',
                     'Get MacPorts' => 'getmp.php',
                     'Available Ports' => 'ports.php',
                     'Documentation' => 'http://geeklair.net/new_macports_guide',
-                    'Support &amp; Development' => "$trac_url"
+                    'Support &amp; Development' => $trac_url
                 );
-
                 foreach ($pages as $title => $url) {
-                    if ($PHP_SELF == $url) {
+                    if (basename($PHP_SELF) == $url) {
                         echo "<li class=\"selected\"><a href=\"$url\" title=\"$title\">$title</a></li>\n";
                     } else {
                         echo "<li><a href=\"$url\" title=\"$title\">$title</a></li>\n";
@@ -44,10 +43,21 @@
         <dt>Shortcuts</dt>
         <dd>
             <ul>
-                <li><a href="<?php print $downloads; ?>">MacPorts Downloads</a></li>
-                <li><a href="<?php print $svn_url; ?>">Subversion Repository</a></li>
-                <li><a href="<?php print $trac_url . 'wiki/FAQ'; ?>">MacPorts FAQ</a></li>
-                <li><a href="<?php print $trac_url . 'newticket'; ?>">Report a Bug</a></li>
+<?php
+                $shortcuts = array (
+                    'MacPorts Downloads' => $downloads,
+                    'MacPorts FAQ' => $trac_url . 'wiki/FAQ',
+                    'Subversion Repository' => $svn_url,
+                    'Report a Bug' => $trac_url . 'newticket'
+                );
+                foreach ($shortcuts as $title => $url) {
+                    if (basename($PHP_SELF) == $url) {
+                        echo "<li class=\"selected\"><a href=\"$url\" title=\"$title\">$title</a></li>";
+                    } else {
+                        echo "<li><a href=\"$url\" title=\"$title\">$title</a></li>";
+                    }
+                }
+?>
             </ul>
         </dd>
     </dl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070914/11facca1/attachment.html


More information about the macports-changes mailing list