Skip to content
Snippets Groups Projects
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
Branches
No related tags found
No related merge requests found
...@@ -39,10 +39,6 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract ...@@ -39,10 +39,6 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract
$staticBaseUrl .= $_SERVER['HTTP_HOST'] $staticBaseUrl .= $_SERVER['HTTP_HOST']
. $baseUrl . '/'; . $baseUrl . '/';
if (!$layout->template) {
$layout->template = 'Fixed';
}
if (!$layout->siteTitle) { if (!$layout->siteTitle) {
$layout->siteTitle = 'Site'; $layout->siteTitle = 'Site';
} }
...@@ -56,17 +52,32 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract ...@@ -56,17 +52,32 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract
'title' => $layout->siteTitle)); 'title' => $layout->siteTitle));
require_once 'UNL/Templates.php'; 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(); $config = Unl_Application::getOptions();
if (isset($config['unl']['templates']['options']) && is_array($config['unl']['templates']['options'])) { if (isset($config['unl']['templates']['options']) && is_array($config['unl']['templates']['options'])) {
UNL_Templates::$options = array_merge(UNL_Templates::$options, $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 = UNL_Templates::factory($layout->template, array('sharedcodepath' => 'sharedcode'));
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->titlegraphic = '<h1>' . $layout->siteTitle . '</h1>';
$template->pagetitle = '<h2>' . $layout->pageTitle . '</h2>'; $template->pagetitle = '<h2>' . $layout->pageTitle . '</h2>';
}
$template->navlinks = $this->_processLinks($layout->navLinks); $template->navlinks = $this->_processLinks($layout->navLinks);
$template->maincontentarea = $layout->content . "\n"; $template->maincontentarea = $layout->content . "\n";
...@@ -112,7 +123,11 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract ...@@ -112,7 +123,11 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract
$template->breadcrumbs = $this->_processLinks($breadcrumbs); $template->breadcrumbs = $this->_processLinks($breadcrumbs);
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>'; $template->doctitle = '<title>' . implode(' | ', $htmlTitle) . '</title>';
}
if (!$layout->leftColLinks) { if (!$layout->leftColLinks) {
$layout->leftColLinks = array(); $layout->leftColLinks = array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment