Commit:    4e44404b1e3142d8a11a17d0f98f35b0e192521f
Author:    Paul Dragoonis <[email protected]>         Sun, 9 Jan 2011 
02:16:29 +0000
Parents:   ebccfc67e1d72227e2f4cb7487b4c958c4e14dc3
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=4e44404b1e3142d8a11a17d0f98f35b0e192521f

Log:
Shortened the number of items on the Documentation mega dropdown. You can limit 
it and it will output a 'View More' link after the last item.

Changed paths:
  M  include/layout.inc


Diff:
diff --git a/include/layout.inc b/include/layout.inc
index b8c2072..706f7b9 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -869,19 +869,19 @@ function doc_toc($lang) {
         $file = dirname(__FILE__) . "/../manual/en/toc/index.inc";
     }
     require dirname(__FILE__) . "/../manual/$lang/toc/index.inc";
-
     echo "<dl>\n";
     doc_toc_list($lang, $TOC, "getting-started");
-    doc_toc_list($lang, $TOC, "langref");
+    doc_toc_list($lang, $TOC, "features");    
+
     echo "</dl>\n";
 
     echo "<dl>\n";
-    doc_toc_list($lang, $TOC, "security");
-    doc_toc_list($lang, $TOC, "features");
+    doc_toc_list($lang, $TOC, "langref", array('limit' => 13));
     echo "</dl>\n";
 
     echo "<dl>\n";
-    doc_toc_list($lang, $TOC, "funcref");
+    doc_toc_list($lang, $TOC, "funcref", array('limit' => 5));
+    doc_toc_list($lang, $TOC, "security", array('limit' => 5));    
     echo "</dl>\n";
 
     echo "<ul>";
@@ -895,12 +895,19 @@ function doc_toc($lang) {
     echo "</ul>\n";
 
 }
-function doc_toc_list($lang, $index, $file) {
+function doc_toc_list($lang, $index, $file, $options = null) {
     include dirname(__FILE__) . "/../manual/$lang/toc/$file.inc";
 
     doc_toc_title($lang, $index, $file);
+    $i = 0;
     foreach($TOC as $entry) {
+        // If a limit was passed in and we have exceeded that limit then stop 
outputting items.
+        if($options !== null && isset($options['limit']) && $i > 
$options['limit']) {
+            echo "\t<dd><a href='/manual/$lang/$file.php'>View more 
..</a></dd>\n";
+            break;
+        }
         echo "\t<dd><a 
href='/manual/$lang/{$entry[0]}'>{$entry[1]}</a></dd>\n";
+        $i++;
     }
 }
 function doc_toc_title($lang, $index, $file, $elm = "dt") {


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to