includes/pageprocess.php
changeset 498 a85af9c28355
parent 481 07bf15b066bc
child 507 586fd7d3202d
equal deleted inserted replaced
497:ecb636490702 498:a85af9c28355
  1844       echo '<!-- Start breadcrumbs -->
  1844       echo '<!-- Start breadcrumbs -->
  1845             <div class="breadcrumbs">
  1845             <div class="breadcrumbs">
  1846               ';
  1846               ';
  1847       if ( $show_home )
  1847       if ( $show_home )
  1848       {
  1848       {
  1849         if ( count($breadcrumb_data) > 1 )
  1849         // Display the "home" link first.
       
  1850         $pathskey = $paths->nslist[ $this->namespace ] . $this->page_id;
       
  1851         if ( $pathskey !== getConfig('main_page') )
       
  1852           echo '<a href="' . makeUrl(getConfig('main_page'), false, true) . '">';
       
  1853         echo $lang->get('onpage_btn_breadcrumbs_home');
       
  1854         if ( $pathskey !== getConfig('main_page') )
       
  1855           echo '</a>';
       
  1856       }
       
  1857       foreach ( $breadcrumb_data as $i => $crumb )
       
  1858       {
       
  1859         $cumulative = implode('/', array_slice($breadcrumb_data, 0, ( $i + 1 )));
       
  1860         if ( $show_home && $cumulative === getConfig('main_page') )
       
  1861           continue;
       
  1862         if ( $show_home || $i > 0 )
       
  1863           echo ' &raquo; ';
       
  1864         $title = ( isPage($cumulative) ) ? get_page_title($cumulative) : get_page_title($crumb);
       
  1865         if ( $i + 1 == count($breadcrumb_data) )
  1850         {
  1866         {
  1851           echo '<a href="' . makeUrl(getConfig('main_page'), false, true) . '">' . $lang->get('onpage_btn_breadcrumbs_home') . '</a> &raquo;';
  1867           echo htmlspecialchars($title);
  1852         }
  1868         }
  1853         else
  1869         else
  1854         {
  1870         {
  1855           echo $lang->get('onpage_btn_breadcrumbs_home');
  1871           $exists = ( isPage($cumulative) ) ? '' : ' class="wikilink-nonexistent"';
       
  1872           echo '<a href="' . makeUrl($cumulative, false, true) . '"' . $exists . '>' . htmlspecialchars($title) . '</a>';
  1856         }
  1873         }
  1857       }
       
  1858       foreach ( $breadcrumb_data as $i => $higherpage )
       
  1859       {
       
  1860         $higherpage = $paths->nslist[$this->namespace] . sanitize_page_id(implode('/', array_slice($breadcrumb_data, 0, ($i+1))));
       
  1861         if ( $higherpage === getConfig('main_page') )
       
  1862           continue;
       
  1863         if ( ($i + 1) == count($breadcrumb_data) )
       
  1864         {
       
  1865           $title = ( $higherpage === getConfig('main_page') ) ? $lang->get('onpage_btn_breadcrumbs_home') : get_page_title($higherpage, false);
       
  1866           if ( !$this->page_exists )
       
  1867           {
       
  1868             $title = explode('/', $title);
       
  1869             $title = array_reverse($title);
       
  1870             $title = $title[0];
       
  1871           }
       
  1872           echo htmlspecialchars($title);
       
  1873           break;
       
  1874         }
       
  1875         else if ( isPage($higherpage) )
       
  1876         {
       
  1877           $title = get_page_title($higherpage, false);
       
  1878           echo '<a href="' . makeUrl($higherpage, false, true) . '">' . htmlspecialchars($title) . '</a>';
       
  1879         }
       
  1880         else
       
  1881         {
       
  1882           $title = get_page_title($higherpage, false);
       
  1883           $title = explode('/', $title);
       
  1884           $title = array_reverse($title);
       
  1885           $title = $title[0];
       
  1886           echo '<a href="' . makeUrl($higherpage, false, true) . '" class="wikilink-nonexistent">' . htmlspecialchars($title) . '</a>';
       
  1887         }
       
  1888         echo ' &raquo; ';
       
  1889       }
  1874       }
  1890       echo '</div>
  1875       echo '</div>
  1891             <!-- End breadcrumbs -->
  1876             <!-- End breadcrumbs -->
  1892             ';
  1877             ';
  1893     }
  1878     }