Commit ad6d3a0f authored by Tim Steiner's avatar Tim Steiner
Browse files

Update WdnTemplate view helper to support version 3.1 of the templates and make it the default.

parent 615b38fe
......@@ -39,10 +39,6 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract
$staticBaseUrl .= $_SERVER['HTTP_HOST']
. $baseUrl . '/';
if (!$layout->template) {
$layout->template = 'Fixed';
}
if (!$layout->siteTitle) {
$layout->siteTitle = 'Site';
}
......@@ -56,17 +52,32 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract
'title' => $layout->siteTitle));
require_once 'UNL/Templates.php';
Unl_Templates::$options['version'] = UNL_Templates::VERSION3;
require_once 'UNL/Templates/CachingService/Null.php';
UNL_Templates::setCachingService(new UNL_Templates_CachingService_Null());
UNL_Templates::$options['version'] = UNL_Templates::VERSION3x1;
$config = Unl_Application::getOptions();
if (isset($config['unl']['templates']['options']) && is_array($config['unl']['templates']['options'])) {
UNL_Templates::$options = array_merge(UNL_Templates::$options, $config['unl']['templates']['options']);
}
if (!$layout->template) {
if (UNL_Templates::$options['version'] == UNL_Templates::VERSION3x1) {
$layout->template = 'Local';
} else {
$layout->template = 'Fixed';
}
}
$template = UNL_Templates::factory($layout->template, array('sharedcodepath' => 'sharedcode'));
$template->titlegraphic = '<h1>' . $layout->siteTitle . '</h1>';
$template->pagetitle = '<h2>' . $layout->pageTitle . '</h2>';
if (in_array(UNL_Templates::$options['version'], array(UNL_Templates::VERSION3x1, '3x1'))) {
$template->titlegraphic = $layout->siteTitle;
$template->pagetitle = '<h1>' . $layout->pageTitle . '</h1>';
} else {
$template->titlegraphic = '<h1>' . $layout->siteTitle . '</h1>';
$template->pagetitle = '<h2>' . $layout->pageTitle . '</h2>';
}
$template->navlinks = $this->_processLinks($layout->navLinks);
$template->maincontentarea = $layout->content . "\n";
......@@ -112,7 +123,11 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract
$template->breadcrumbs = $this->_processLinks($breadcrumbs);
$template->doctitle = '<title>' . implode(' | ', $htmlTitle) . '</title>';
if (in_array(UNL_Templates::$options['version'], array(UNL_Templates::VERSION3x1, '3x1'))) {
$template->doctitle = '<title>' . implode(' | ', array_reverse($htmlTitle)) . '</title>';
} else {
$template->doctitle = '<title>' . implode(' | ', $htmlTitle) . '</title>';
}
if (!$layout->leftColLinks) {
$layout->leftColLinks = array();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment