removed 2 breadcrumbs functions that did nothing and added a a few lines of code to create breadcrumbs
authorMilos Dinic <milos@mozilla-europe.org>
Sat, 13 Nov 2010 14:36:00 +0100
changeset 38 3c2ee4ab9e85bde6e95057547e598f6bc3324287
parent 37 825d30d1cf7b59ccad5acfdd2466d1b4f1a35aa4
child 39 cdead97071b5570675899779c2ba4d14b06ef2b9
push id17
push userzbraniecki@mozilla.com
push dateWed, 17 Nov 2010 15:15:17 +0000
removed 2 breadcrumbs functions that did nothing and added a a few lines of code to create breadcrumbs
mediawiki/skins/gmo.php
--- a/mediawiki/skins/gmo.php
+++ b/mediawiki/skins/gmo.php
@@ -97,43 +97,16 @@ class GMOTemplate extends QuickTemplate 
             $doctype .= '<html xmlns="'.$this->data['xhtmldefaultnamespace'].'"';
             foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
                 $doctype .= 'xmlns:'.$tag.'="'.$ns.'" ';
             }
             $doctype .= ' xml:lang="'.$this->data['lang'].'" lang="'.$this->data['lang'].'" dir="'.$this->data['dir'].'">';
             print($doctype);
         }
     }
-     /*************************************************************************************************/
-
-        function title_crumbs($title) {
-            $elems = explode('/',$this->data['titletext']);
-            $elems2 = Array();
-            $url = Array();
-            foreach($elems as $v) {
-                $url[] = str_replace(' ','_',$v);
-                $elems2[] = Array(str_replace('$1',implode('/',$url),$this->data['articlepath']), $v);
-            }
-            $title = array_pop($elems); // take last element as title
-            array_pop($elems2); // and remove the last element from crumbs
-            return Array($elems2, $title);
-        }
-        
-        /*************************************************************************************************/
-        function crumbs($arr=Array()) {
-            array_unshift($arr, $t = Array('http://contribute.mozilla.org', 'Contribute'));
-            array_unshift($arr, $t = Array('http://www.mozilla.org', 'Home'));
-            print('<p id="crumbs">');
-            foreach($arr as $v) {
-                print('<a href="'.$v[0].'">'.$v[1].'</a> / ');
-            }
-            print('</p>'); 
-        }
-        
-        /*************************************************************************************************/
     
     /*************************************************************************************************/
     function head() {
 ?>
 <head>
     <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>"/>
     <meta name="keywords" content="web browser, mozilla, firefox, foxfire, camino, thunderbird, bugzilla, user agent, email client, seamonkey, calendar, lightning, open web, better internet" />
     <title><?php $this->text('pagetitle') ?></title>
@@ -190,23 +163,19 @@ class GMOTemplate extends QuickTemplate 
             </ul>
         </div>
     </div>
 </div>
 
 <div id="main">
     <?php
         }
-        
 
         function body() {
-        
-            $ar = $this->title_crumbs($this->data['title']);
-            $title = $ar[1];
-            $crumbs = $ar[0];
+            $title = $this->data['title'];
             $mix = $this->extractTOC($this->data['bodytext']);
             $body = $mix[0];
             $toc = $mix[1];
             $menu = $toc?True:False;
 
             if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php }
     ?>
             <div id="wiki-tools">
@@ -238,17 +207,33 @@ class GMOTemplate extends QuickTemplate 
                     </div>
                   <?php }} ?>
                 </div>
             </div>
             
             <div id="main-content"<?php if($menu)print(' class="with-menu"');?>>              
                 <h1 id="page-title"><?php print($title);?></h1>
                 <hr>
-                <?php $this->crumbs($crumbs); ?>
+                <?php 
+                $pieces = explode("/", $_SERVER['REQUEST_URI']);
+                array_shift($pieces);
+                $last_piece = end($pieces); /* define a last item in array */
+                foreach ($pieces as $key => $url) {
+                    $label = ucwords($url);
+                    $url = "http://localhost/";  /* define url, WITH A TRAILING SLASH, to which we're gonna add pieces later */
+                    for ($i = 0; $i <= $key; $i++) { 
+                        $url .= $pieces[$i] . "/"; 
+                    }
+                    if ($url != "" && $label != $last_piece) { /* don't put | sign after the last piece */
+                    echo "<span> <a href=" . $url . ">" . $label . "</a></span> |";
+                    } else {
+                        echo "<span> <a href=" . $url . ">" . $label . "</a></span>";
+                    }
+                }
+                ?>
                 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
                 <div id="contentSub"><?php $this->html('subtitle') ?></div>
                 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php     $this->html('undelete') ?></div><?php } ?>
                 <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk')  ?></div><?php } ?>
                 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
                 <!-- start content -->
                 <?php if($menu)
               $this->toc($toc); ?>