Skip to content
Snippets Groups Projects
Commit c6a511a8 authored by Kevin Abel's avatar Kevin Abel
Browse files

Support render-time generated breadcrumbs

parent c1e67e56
No related branches found
No related tags found
No related merge requests found
<?php
namespace UNL\Catalog;
class Breadcrumbs
{
protected $crumbs = array();
public function addCrumb($title, $url = false)
{
$this->crumbs[] = array(
'title' => $title,
'url' => $url,
);
return $this;
}
public function getCrumbs()
{
return $this->crumbs;
}
}
<ul>
<li><a href="http://www.unl.edu/">UNL</a>
<li><a href="http://svcaa.unl.edu/">Academic Affairs</a>
<li><a href="<?php echo $controller->getURL() ?>">Bulletins</a>
<?php foreach ($context->getCrumbs() as $crumb): ?>
<?php $isUrl = isset($crumb['url']) && $crumb['url']; ?>
<li>
<?php if ($isUrl): ?>
<a href="<?php echo $crumb['url'] ?>">
<?php endif; ?>
<?php echo $crumb['title'] ?>
<?php if ($isUrl): ?>
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php
UNL_Templates::setCachingService(new UNL_Templates_CachingService_Null());
UNL_Templates::$options['version'] = 4;
UNL_Templates::$options['sharedcodepath'] = dirname(__FILE__).'/sharedcode';
$url = $controller->getURL();
$page = UNL_Templates::factory('Fixed');
......@@ -9,16 +8,12 @@ $page = UNL_Templates::factory('Fixed');
$savvy->addGlobal('page', $page);
$page->head .= '<link rel="stylesheet" type="text/css" href="' . $url . 'templates/html/css/all.css" />';
$page->head .= '<link rel="search" href="'.$url.'?cx=015236299699564929946%3Aipiaeommikw&amp;cof=FORID%3A11&amp;view=search" />';
$page->head .= '<link rel="home" href="'.$url.'" />';
$page->doctitle = '<title>Bulletins | University of Nebraska-Lincoln</title>';
$page->titlegraphic = 'UNL Bulletins';
$page->titlegraphic = 'Bulletins';
$page->maincontentarea = '';
$page->pagetitle = '';
$page->breadcrumbs = '<ul>
<li class="first"><a href="http://www.unl.edu/">UNL</a></li>
<li>Bulletins</li>
</ul>';
$page->breadcrumbs = new \UNL\Catalog\Breadcrumbs();
$page->footercontent = $savvy->render(null, 'Footer.tpl.php');
$page->leftcollinks = $savvy->render(null, 'RelatedLinks.tpl.php');
$page->contactinfo = $savvy->render(null, 'FooterContactInfo.tpl.php');
......@@ -28,17 +23,13 @@ $page->addStylesheet($url . 'templates/catalog.css');
$page->head .= '
<script type="text/javascript">var UNL_UGB_URL = "'.$url.'";</script>
<script type="text/javascript" src="'.$url.'templates/scripts/bulletin.functions.js"></script>
<link rel="home" href="'.$url.'" />
<link rel="search" href="'.$url.'search/" />
<script type="text/javascript" src="'.$url.'templates/html/scripts/bulletin.functions.js"></script>
';
$page->maincontentarea = '';
if (get_class($context->getRaw('output')) == 'UNL\Catalog\SubjectAreas') {
$page->maincontentarea .= $savvy->fetch($context->output, 'UNL/Catalog/SubjectAreas.tpl.php');
} else {
$page->maincontentarea .= $savvy->render($context->output);
if (!is_string($page->breadcrumbs)) {
$page->breadcrumbs = $savvy->render($page->breadcrumbs);
}
echo $page;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment