[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-cvs
Subject:    [PEAR-CVS] cvs: pearweb /include pear-format-html.php
From:       "Thomas V.V.Cox" <cox () idecnet ! com>
Date:       2001-12-29 18:27:05
[Download RAW message or body]

cox		Sat Dec 29 13:27:05 2001 EDT

  Modified files:              
    /pearweb/include	pear-format-html.php 
  Log:
  make html_category_urhere() more flexible
  
  
Index: pearweb/include/pear-format-html.php
diff -u pearweb/include/pear-format-html.php:1.24 pearweb/include/pear-format-html.php:1.25
--- pearweb/include/pear-format-html.php:1.24	Sat Dec 29 00:45:58 2001
+++ pearweb/include/pear-format-html.php	Sat Dec 29 13:27:05 2001
@@ -195,7 +195,7 @@
 			print "</td>\n";
 		}
 		print "$i    </tr>\n";
-		
+
 	}
 
 	function headRow() {
@@ -239,7 +239,7 @@
 		}
 		print ">$text</td>\n";
 		print "$i    </tr>\n";
-		
+
 	}
 }
 
@@ -251,27 +251,38 @@
     print $border->toHtml();
 }
 
-// prints "urhere" menu bar
-function html_category_urhere($id, $name=null)
+/**
+* prints "urhere" menu bar
+* Top Level :: XML :: XML_RPC
+* @param bool $link_lastest If the last category should or not be a link
+*/
+function html_category_urhere($id, $link_lastest = false)
 {
     global $PHP_SELF;
-    $html = "<a href=\"$PHP_SELF\">Top Level</a>";
+    $html = "<a href=\"packages.php\">Top Level</a>";
     if ($id !== null) {
         global $dbh;
         $res = $dbh->query("SELECT c.id, c.name
                             FROM categories c, categories cat
                             WHERE cat.id = $id
-                            AND c.cat_left < cat.cat_left
-                            AND c.cat_right > cat.cat_right");
-
+                            AND c.cat_left <= cat.cat_left
+                            AND c.cat_right >= cat.cat_right");
+        $nrows = $res->numRows();
+        $i = 0;
         while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) {
+            if (!$link_lastest && $i >= $nrows -1) {
+                break;
+            }
             $html .= "  :: ".
-                     "<a href=\"$PHP_SELF?catpid={$row['id']}&catname={$row['name']}\">".
+                     "<a href=\"/packages.php?catpid={$row['id']}&catname={$row['name']}\">".
                      "{$row['name']}</a>";
+            $i++;
+        }
+        if (!$link_lastest) {
+            $html .= "  :: <b>".$row['name']."</b>";
         }
-        $html .= "  :: <b>".htmlspecialchars($name)."</b>";
     }
-    print "$html";
+    print $html;
 }
 
 function localRedirect($file)



-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, e-mail: pear-cvs-unsubscribe@lists.php.net
For additional commands, e-mail: pear-cvs-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic