aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/views/default/pages/breadcrumbs.php
blob: 9c95c64c25ce180fdebdfd5104fb532367564573 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
 * Breadcrumbs for pages.
 *
 * @package ElggPages
 */

$page_owner = elgg_get_page_owner_guid();
$parent = $vars['parent'];

$breadcrumbs = '';

$owner_url = elgg_get_site_url() . "pg/pages/owned/" . get_entity($page_owner)->username;
echo "<div id='breadcrumbs'><b><a href=\"{$owner_url}\">" . elgg_echo('pages:user') . "</a></b>";

//see if the new page's parent has a parent
$getparent = get_entity($parent->parent_guid);
while ($getparent instanceof ElggObject){
	$breadcrumbs = " &gt; <a href=\"{$getparent->getURL()}\">$getparent->title</a>" . $breadcrumbs;
	$getparent = get_entity($getparent->parent_guid);
}

echo $breadcrumbs;

//if it is adding a page, make the last page a link, otherwise, don't
if ($vars['add']){
	echo " &gt; <a href=\"{$parent->getURL()}\">$parent->title</a></div>";
} else {
	echo " &gt; $parent->title</div>";
}