Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Guindon2014-04-17 00:31:46 +0000
committerChristopher Guindon2014-04-17 00:31:46 +0000
commit4dd2e8b6cbd11b2ac4612b16ab35104c8c8b026a (patch)
tree1c2921e180420863d1cec4bc46cbb80fc66f2ece
parent9fa93e7ca65ab85fbee8519c5547ab2fce6275c1 (diff)
downloadeclipse.org-common-4dd2e8b6cbd11b2ac4612b16ab35104c8c8b026a.tar.gz
eclipse.org-common-4dd2e8b6cbd11b2ac4612b16ab35104c8c8b026a.tar.xz
eclipse.org-common-4dd2e8b6cbd11b2ac4612b16ab35104c8c8b026a.zip
Implement breadcrumb like navigation
Signed-off-by: Christopher Guindon <chris.guindon@eclipse.org>
-rw-r--r--system/app.class.php8
-rw-r--r--themes/solstice/app/app.php20
-rw-r--r--themes/solstice/menu.php5
3 files changed, 27 insertions, 6 deletions
diff --git a/system/app.class.php b/system/app.class.php
index afa829c2..aaba3be2 100644
--- a/system/app.class.php
+++ b/system/app.class.php
@@ -430,9 +430,13 @@ class App {
return str_replace("\n", "<br />", $_String);
}
- function generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html) {
+ function generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html, $Breadcrumb = NULL) {
- # OPT1: ob_start();
+ # Breadcrumbs for the new solstice theme.
+ if ($Breadcrumb == NULL || !is_object($Breadcrumb)) {
+ require_once('breadcrumbs.class.php');
+ $Breadcrumb = new Breadcrumb();
+ }
# All web page parameters passed for variable scope
if($theme == "") {
diff --git a/themes/solstice/app/app.php b/themes/solstice/app/app.php
index 812ef0f5..8da73a21 100644
--- a/themes/solstice/app/app.php
+++ b/themes/solstice/app/app.php
@@ -16,6 +16,25 @@ function solstice_variables(&$variables) {
$base_url = '//staging.eclipse.org/';
$Nav = $variables['page']['Nav'];
$Menu = $variables['page']['Menu'];
+ $Breadcrumb = $variables['page']['Breadcrumb'];
+
+ // Breadcrumbs
+ $crumb_list = $Breadcrumb->getCrumbList();
+
+ // fetch key of the last element of the array.
+ $crumb_last_key = $Breadcrumb->getCrumbCount()-1;
+
+ $variables['breadcrumbs'] = '<ol class="breadcrumb">';
+ foreach ($crumb_list as $k => $v) {
+ // add .active class to the last item of the breadcrumbs
+ if($k == $crumb_last_key) {
+ $variables['breadcrumbs'] .= '<li class="active">' . $v->getText() . '</li>';
+ }
+ else {
+ $variables['breadcrumbs'] .= '<li><a href="' . $v->getURL() . '">' . $v->getText() . '</a></li>';
+ }
+ }
+ $variables['breadcrumbs'] .= "</ol>";
// If the main menu is custom, do not change it
$NewMenu = new $Menu();
@@ -244,6 +263,7 @@ $variables['page']['theme'] = $theme;
$variables['page']['Nav'] = $Nav;
$variables['page']['Menu'] = $Menu;
$variables['page']['html'] = $html;
+$variables['page']['Breadcrumb'] = $Breadcrumb;
$variables['page']['extra_headers'] = (isset($extraHtmlHeaders)) ? $extraHtmlHeaders : "";
solstice_variables($variables);
diff --git a/themes/solstice/menu.php b/themes/solstice/menu.php
index 879f8138..03fbb434 100644
--- a/themes/solstice/menu.php
+++ b/themes/solstice/menu.php
@@ -89,10 +89,7 @@
<?php if (!$variables['theme_variables']['hide_breadcrumbs']) :?>
<section id="breadcrumb" class="<?php print $variables['theme_variables']['breadcrumbs_classes'];?>">
<div class="container">
- <ol class="breadcrumb">
- <li><a href="<?php print $variables['url']; ?>">Home</a></li>
- <li class="active"><?php print $variables['page']['title'];?></li>
- </ol>
+ <?php print $variables['breadcrumbs'];?>
<?php print $variables['theme_variables']['breadcrumbs_html'];?>
</div>
</section>

Back to the top