From: Steve Sutton Date: Tue, 12 Aug 2014 15:54:50 +0000 (-0400) Subject: Add in main nav X-Git-Tag: V1.0^2~107 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=bf3201e02762812b8c852dbfdc619da4dbd5b514;p=web%2FKeweenaw.git Add in main nav Setup the main nav. For the correct links. Need to work on the images. --- diff --git a/Toolkit/Page.php b/Toolkit/Page.php index af09afd..11e8e02 100755 --- a/Toolkit/Page.php +++ b/Toolkit/Page.php @@ -455,6 +455,8 @@ class Toolkit_Page $this->_navigationFactory->setGateway($this->_pageGateway); $this->mainNav = $this->_getMainNav($this->_catid); $this->sideNav = $this->_getSideNav($this->_catid); + // main Navigation output + $this->mainNavigationUl = $this->_getMainNavigation(); $this->newsletterAction = Toolkit_Template_Page::getSeoUrl( $this->_pageGateway, 10 @@ -564,19 +566,35 @@ class Toolkit_Page */ private function _getMainNav($catid) { - $nav = $this->_navigationFactory->createMainNav(); - $mainNavArray = $nav->getNavStructure($this->_pageGateway, $catid); - - return $nav->renderPageNav($mainNavArray, 'tree'); + $sideNav = new Toolkit_Template_Navigation_AllInOneSideNav( + $this->_pageGateway + ); + $nav = $sideNav->getNavigation(); + $html = $this->_arrayToListHTML($nav); + return ($html) ? $html : ''; } - private function _getArrayToListNav($catid) + private function _getMainNavigation() { + if (defined('MAIN_LEVEL_NAV_ARRAY') && MAIN_LEVEL_NAV_ARRAY) { + $mainNavArray = unserialize(MAIN_LEVEL_NAV_ARRAY); + } $sideNav = new Toolkit_Template_Navigation_AllInOneSideNav( $this->_pageGateway ); $nav = $sideNav->getNavigation(); - $html = $this->_arrayToListHTML($nav, 0, "mainNav"); + $newNav = array(); + foreach ($nav as $key => $item) { + if (in_array($item['id'], $mainNavArray)) { + $key = array_search($item['id'], $mainNavArray); + if ($key !== false) { + $item['class'] = $key; + } + $newNav[] = $item; + } + } +// echo '
'.print_r($newNav, true).'
';exit; + $html = $this->_arrayToListHTML($newNav, 0, 'left'); return ($html) ? $html : ''; } @@ -588,17 +606,27 @@ class Toolkit_Page return; } $tabs = str_repeat($tab, $level * 2); - $mainClass = ($level == 0 && $className) ? ' class="'.$className.'"': ''; + $mainClass = ($level == 0 && $className) + ? ' class="'.$className.'"' + : ' class="dropdown"'; $result = "{$tabs}\n"; foreach ($array as $i => $node) { - $class - = ($node['class'] == 'current') - ? ' class="'.$node['class'].'"' - : ''; - $parent - = ($node['class'] == 'parent') - ? ' class="'.$node['class'].'"' - : ''; + $classes = array(); +// $class +// = ($node['class'] == 'current') +// ? ' class="'.$node['class'].'"' +// : ''; + if ($node['class']) { + $classes[] = $node['class']; + } + if (!empty($node['pages'])) { + $classes[] = 'has-dropdown'; + } + $parent = ' class="'.implode(' ', $classes).'"'; +// $parent +// = ($node['class'] == 'parent') +// ? ' class="'.$node['class'].'"' +// : ' class="not-click"'; $link = sprintf( $format, $node['uri'], diff --git a/setup.phtml b/setup.phtml index 151b9d7..a4f7c66 100644 --- a/setup.phtml +++ b/setup.phtml @@ -54,6 +54,15 @@ if (!isset($DEBUG)) { } $securePagesArray = array(); define('SECURE_PAGES', serialize($securePagesArray)); +$mainNavigationUl = array( + 'activities' => 2, + 'attractions' => 7, + 'lodging' => 13, + 'restaurants' => 14, + 'shopping' => 15, + 'calendar' => 16 +); +define('MAIN_LEVEL_NAV_ARRAY', serialize($mainNavigationUl)); $nonMobilePagesArray = array(); define('NON_MOBILE_PAGES', serialize($nonMobilePagesArray)); /** diff --git a/templates/template.html b/templates/template.html index 8826cab..8f2e941 100644 --- a/templates/template.html +++ b/templates/template.html @@ -62,7 +62,8 @@
-
    + {mainNavigationUl:h} +