svn: /web/php/trunk/include/ layout.inc

[email protected] (Paul Dragoonis)
Newsgroups php.webmaster
Message-ID <[email protected]>
dragoonis                                Sun, 09 Jan 2011 02:16:29 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=307291

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:
    U   web/php/trunk/include/layout.inc

Modified: web/php/trunk/include/layout.inc
===================================================================
--- web/php/trunk/include/layout.inc	2011-01-08 23:17:50 UTC (rev 307290)
+++ web/php/trunk/include/layout.inc	2011-01-09 02:16:29 UTC (rev 307291)
@@ -869,19 +869,19 @@
         $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 @@
     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") {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.