aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/navigation')
-rw-r--r--views/default/navigation/breadcrumbs.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/views/default/navigation/breadcrumbs.php b/views/default/navigation/breadcrumbs.php
new file mode 100644
index 000000000..1dc97f29c
--- /dev/null
+++ b/views/default/navigation/breadcrumbs.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Displays registered breadcrumbs.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ *
+ * @uses optional $vars['breadcrumbs'] = array('title' => 'The title', 'link' => 'url')
+ *
+ */
+
+if (isset($vars['breadcrumbs'])) {
+ $breadcrumbs = $vars['breadcrumbs'];
+} else {
+ $breadcrumbs = elgg_get_breadcrumbs();
+}
+
+$formatted_breadcrumbs = array();
+
+foreach ($breadcrumbs as $breadcrumb) {
+ $link = $breadcrumb['link'];
+ $title = $breadcrumb['title'];
+
+ if (!empty($link)) {
+ $formatted_breadcrumbs[] = elgg_view('output/url', array(
+ 'href' => $link,
+ 'text' => $title
+ ));
+ } else {
+ $formatted_breadcrumbs[] = $title;
+ }
+}
+
+$breadcrumbs_html = implode(' &gt; ', $formatted_breadcrumbs);
+
+echo <<<___END
+
+<div id="breadcrumbs">
+ $breadcrumbs_html
+</div>
+
+___END;
+?> \ No newline at end of file