From: Steve Sutton Date: Tue, 12 Aug 2014 13:43:22 +0000 (-0400) Subject: Working in the template X-Git-Tag: V1.0^2~111 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=73ce0d1db1596aa8164d67c0fd06c8ed22b00e9b;p=web%2FKeweenaw.git Working in the template Working in some changes for how the toolbox is output by setting it up to use the template for toolbox.html. --- diff --git a/Toolkit/Page.php b/Toolkit/Page.php index e34db36..9c1444e 100755 --- a/Toolkit/Page.php +++ b/Toolkit/Page.php @@ -423,6 +423,7 @@ class Toolkit_Page $this->toolboxContent = $this->_toolboxPage->getBody( $this->_catid, $bodyFactory ); +// echo '
'.print_r($this->toolboxContent, true).'
';exit; $page = $this->_pageGateway->find($this->_catid); $this->topParentId = $this->_pageGateway->findTopParent($this->_catid); @@ -453,7 +454,7 @@ class Toolkit_Page $this->pageId = $this->_catid; } $this->_navigationFactory->setGateway($this->_pageGateway); - $this->mainNav = $this->_getMainNav($this->_catid); + $this->mainNav = $this->_getMainNav($this->_catid); $this->sideNav = $this->_getSideNav($this->_catid); $this->newsletterAction = Toolkit_Template_Page::getSeoUrl( @@ -566,10 +567,10 @@ class Toolkit_Page { $nav = $this->_navigationFactory->createMainNav(); $mainNavArray = $nav->getNavStructure($this->_pageGateway, $catid); - + return $nav->renderPageNav($mainNavArray, 'tree'); } - + private function _getArrayToListNav($catid) { $sideNav = new Toolkit_Template_Navigation_AllInOneSideNav( @@ -579,7 +580,7 @@ class Toolkit_Page $html = $this->_arrayToListHTML($nav, 0, "mainNav"); return ($html) ? $html : ''; } - + private function _arrayToListHTML($array, $level = 0, $className = null) { static $tab = "\t", $format = '%s'; diff --git a/Toolkit/Template/Image/Left.php b/Toolkit/Template/Image/Left.php index 6fb37f1..81eb650 100644 --- a/Toolkit/Template/Image/Left.php +++ b/Toolkit/Template/Image/Left.php @@ -45,14 +45,14 @@ class Toolkit_Template_Image_Left extends Toolkit_Template_Image_ImageAbstract { $imageData = $this->_adapter->getImageSize($size . $this->_src); - $html = '
'; + $html = '
'; $html .= parent::getImage($size); if (!empty($this->_caption)) { - $html .= '
'; + $html .= '
'; $html .= $this->_caption; - $html .= '
'; + $html .= ''; } - $html .= '
'; + $html .= ''; return $html; } diff --git a/Toolkit/Template/Image/Right.php b/Toolkit/Template/Image/Right.php index f1ef03b..c115068 100644 --- a/Toolkit/Template/Image/Right.php +++ b/Toolkit/Template/Image/Right.php @@ -45,14 +45,14 @@ class Toolkit_Template_Image_Right extends Toolkit_Template_Image_ImageAbstract { $imageData = $this->_adapter->getImageSize($size . $this->_src); - $html = '
'; + $html = '
'; $html .= parent::getImage($size); if (!empty($this->_caption)) { - $html .= '
'; + $html .= '
'; $html .= $this->_caption; - $html .= '
'; + $html .= ''; } - $html .= '
'; + $html .= ''; return $html; } diff --git a/Toolkit/Template/Page/Member.php b/Toolkit/Template/Page/Member.php index 3eff26d..aa8dbf7 100644 --- a/Toolkit/Template/Page/Member.php +++ b/Toolkit/Template/Page/Member.php @@ -351,53 +351,36 @@ class Toolkit_Template_Page_Member extends Toolkit_Template_Page_Toolbox $breadCrumbsBuilder = $this->breadCrumbsFactory->createBreadCrumbsHelper(); $page = $this->pageGateway->find($this->id); - $coupons = null; - if (defined('COUPONS') && COUPONS) { - $coupons = $this->_getPageCoupons($this->id); - } - - if ($memberId = filter_input(INPUT_GET, 'member_id', FILTER_VALIDATE_INT)) { - // check and see if the member is inactive - // if they are then don't show bread crumb and give out 404 header - if (!$this->_isMemberActive($memberId)) { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); - $badPage = new Toolkit_Template_Page_Bad(); - return $badPage->getContent(); - } else { - $breadCrumbs = $breadCrumbsBuilder->toHtml($this->id); - $profile = $this->_getMemberProfilePage($this->id); - return $breadCrumbs . - $profile; - } - } elseif (!$page['search_form']) { - $breadCrumbs = $breadCrumbsBuilder->toHtml($this->id); - $searchResults = $this->_getMemberSearchResults($this->id); - $secondaryParagraphs = $this->getSecondaryParagraphs($this->id); - $primaryParagraph = $this->getPrimaryParagraph($this->id); - - return $breadCrumbs . - $primaryParagraph . - $searchResults . - $coupons . - $secondaryParagraphs; - } elseif (isset($_GET['search'])) { - $breadCrumbs = $breadCrumbsBuilder->toHtml($this->id); - $searchResults = $this->_getMemberSearchResults($this->id); - - return $breadCrumbs . - $searchResults; - } else { - $breadCrumbs = $breadCrumbsBuilder->toHtml($this->id); - $searchForm = $this->_getMemberSearchForm($this->id); - $secondaryParagraphs = $this->getSecondaryParagraphs($this->id); - $primaryParagraph = $this->getPrimaryParagraph($this->id); - - return $breadCrumbs . - $primaryParagraph . - $searchForm . - $coupons . - $secondaryParagraphs; - } + $tpl + = new HTML_Template_Flexy($GLOBALS['flexyOptions']); + $tPage = new stdClass(); + $tPage->pods = ''; + $tPage->isMainLevel = false; + $tPage->title = $page['title']; + $tPage->photos = $photoGalleryContent; + $tPage->coupons = null; + $tPage->specials = $specials; + $tPage->staticPageContent + = $this->getStaticPageContent($this->id); + $tPage->breadCrumbs + = $breadCrumbsBuilder->toHtml($this->id); + $tPage->primaryParagraph + = $this->getPrimaryParagraph($this->id); + $tPage->secondaryParagraphs + = $this->getSecondaryParagraphs($this->id); + + if (filter_input(INPUT_GET, 'member_id', FILTER_VALIDATE_INT)) { + $tPage->profile = $this->_getMemberProfilePage($this->id); + } elseif (!$page['search_form']) { + $tPage->searchResults = $this->_getMemberSearchResults($this->id); + } elseif (isset($_GET['search'])) { + $tPage->searchResults = $this->_getMemberSearchResults($this->id); + } else { + $tPage->searchForm = $this->_getMemberSearchForm($this->id); + } + return $tPage; +// $tpl->compile('toolbox.html'); +// return $tpl->bufferedOutputObject($tPage); } // }}} diff --git a/Toolkit/Template/Page/Toolbox.php b/Toolkit/Template/Page/Toolbox.php index 1e50f90..515fa0a 100644 --- a/Toolkit/Template/Page/Toolbox.php +++ b/Toolkit/Template/Page/Toolbox.php @@ -150,27 +150,53 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody */ public function getContent() { - $breadCrumbsBuilder = $this->breadCrumbsFactory->createBreadCrumbsHelper(); - $breadCrumbs = $breadCrumbsBuilder->toHtml($this->id); - $secondaryParagraphs = $this->getSecondaryParagraphs($this->id); - $primaryParagraph = $this->getPrimaryParagraph($this->id); - $coupons = null; - if (defined('COUPONS') && COUPONS) { - $coupons = $this->_getPageCoupons($this->id); - } - $staticPageContent = $this->getStaticPageContent($this->id); + $page = $this->pageGateway->find($this->id); + $breadCrumbsBuilder + = $this->breadCrumbsFactory->createBreadCrumbsHelper(); $photoGalleryContent = null; if (defined('PHOTO_GALLERY') && PHOTO_GALLERY) { - $photoGalleryContent = $this->photoGallery->getPageGallery($this->id); + $photoGalleryContent + = $this->photoGallery->getPageGallery($this->id); } - return $breadCrumbs . - $primaryParagraph . - $staticPageContent . - $secondaryParagraphs . - $coupons . - $photoGalleryContent; +// $mainNavCategories +// = (defined('MAIN_NAV_PAGES') && MAIN_NAV_PAGES) +// ? unserialize(MAIN_NAV_PAGES) +// : null; + +// $tpl +// = new HTML_Template_Flexy($GLOBALS['flexyOptions']); + $tPage = new stdClass(); +// if ( isset($mainNavCategories) +// && is_array($mainNavCategories) +// && in_array($this->id, $mainNavCategories)) { +// $tPage->isMainLevel = true; +// } else { +// $tPage->pods = ''; +// $tPage->isMainLevel = false; +// } + if ($page) { + $tPage->title = $page['title']; + $tPage->photos = $photoGalleryContent; + $tPage->coupons + = (defined('COUPONS')) + ? $this->_getPageCoupons($this->id) + : null; + // $tPage->specials = $specials; + $tPage->staticPageContent + = $this->getStaticPageContent($this->id); + $tPage->breadCrumbs + = $breadCrumbsBuilder->toHtml($this->id); + $tPage->primaryParagraph + = $this->getPrimaryParagraph($this->id); + $tPage->secondaryParagraphs + = $this->getSecondaryParagraphs($this->id); + } + + return $tPage; +// $tpl->compile('toolbox.html'); +// return $tpl->bufferedOutputObject($tPage); } // }}} @@ -254,6 +280,11 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody } // }}} + protected function getMainParagraphImage(array $data, $side) + { + $imageBuilder = $this->imageFactory->getImageBuilder($data, $side); + return $imageBuilder->getImage(TOOLBOX_RESIZED); + } // {{{ getParagraphImage() /** @@ -311,7 +342,7 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody $cache = $this->cache->get("page-$id", 'Toolbox'); if ($cache) { - return $cache; + return unserialize($cache); } else { $page = $this->pageGateway->find($id); @@ -327,19 +358,32 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody break; } - $html = '
'; - $html .= "

{$page['title']}

"; - if ($page['paragraph_links']) { - $html .= $this->getParagraphLinks(); + $title = $page['title']; + $links + = ($page['paragraph_links']) + ? $this->getParagraphLinks() + : ''; + if ($page && !$page['hide_image']) { + $image = $this->getMainParagraphImage($page, $side); } - $html .= $this->getParagraphImage($page, $side); - $html .= $this->keywordReplacement->findAndReplace($page['description']); - $html .= '
'; - - $this->cache->save($html, "page-$id", 'Toolbox'); + $description + = $this->keywordReplacement + ->findAndReplace($page['description']); + $primaryParagraph = array( + 'title' => $title, + 'description' => $description, + 'image' => $image, + 'links' => $links, + 'hide_image' => $page['hide_image'] + ); + $this->cache->save( + serialize($primaryParagraph), + "page-$id", + 'Toolbox' + ); } - return $html; + return $primaryParagraph; } // }}} @@ -361,7 +405,11 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody if ($cache) { return $cache; } else { + $sections = array(); $page = $this->pageGateway->find($id); + if (!$page) { + return false; + } $paragraphs = $this->paragraphGateway->findAll($id); $side = array('left', 'right'); @@ -390,22 +438,27 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody break; } - $html = ''; +// $html = ''; $linksFormat = '%s'; foreach ($paragraphs as $paragraph) { if ($paragraph['active']) { - $html .= '
'; - $html .= "

{$paragraph['title']}

"; - $html .= $this->getParagraphImage($paragraph, $side[$key]); - $html .= $this->keywordReplacement->findAndReplace($paragraph['description']); - - $html .= $this->getParagraphFiles($paragraph['files']); + $sect = array(); + $sect = $paragraph; +// $html .= '
'; +// $html .= "

{$paragraph['title']}

"; + $sect['image'] = $this->getParagraphImage($paragraph, $side[$key]); +// $html .= $this->getParagraphImage($paragraph, $side[$key]); + $sect['description'] = $this->keywordReplacement->findAndReplace($paragraph['description']); +// $html .= $this->keywordReplacement->findAndReplace($paragraph['description']); + $sect['files'] = $this->getParagraphFiles($paragraph['files']); +// $html .= $this->getParagraphFiles($paragraph['files']); if ($paragraph['back_to_top']) { - $html .= 'Back to Top'; + $sect['back_to_top'] = 'Back to Top'; +// $html .= 'Back to Top'; } - $html .= '
'; +// $html .= '
'; $this->paragraphLinks[] = sprintf( $linksFormat, @@ -413,11 +466,13 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody $paragraph['title'] ); $key = $flip ? !$key : $key; + $sections[] = $sect; } } $this->cache->save($html, "paragraphs-$id", 'Toolbox'); - return $html; +// return $html; + return $sections; } } diff --git a/Toolkit/Toolbox/PageGatewayAbstract.php b/Toolkit/Toolbox/PageGatewayAbstract.php index 727b341..43e8904 100644 --- a/Toolkit/Toolbox/PageGatewayAbstract.php +++ b/Toolkit/Toolbox/PageGatewayAbstract.php @@ -209,7 +209,7 @@ abstract class Toolkit_Toolbox_PageGatewayAbstract ? HOMEPAGE_HEADLINE_THUMB . $row['image'] : '', 'header' => $row['navigation_name'], - 'descr' => nl2br($row['headline_intro']), + 'descr' => $row['headline_intro'], ); if (++$count > 4) { $count = 1; diff --git a/config/application.ini b/config/application.ini index a859c76..a1e2780 100644 --- a/config/application.ini +++ b/config/application.ini @@ -51,7 +51,7 @@ eventdb.application = On ; Turn the Events Common Application On or Off eventdb.commonEvents = On ; The page id in the toolbox that holds the event calendar -eventdb.event_page = Off +eventdb.event_page = 16 ; Turn the home page events module On or Off for the event application eventdb.home_events = Off diff --git a/static/16.phtml b/static/16.phtml new file mode 100755 index 0000000..787519e --- /dev/null +++ b/static/16.phtml @@ -0,0 +1,25 @@ +toHTML($this->keywordReplacement); +} + diff --git a/templates/template.html b/templates/template.html index 8e43d0f..eabe50b 100644 --- a/templates/template.html +++ b/templates/template.html @@ -1,46 +1,240 @@ - - -{pageTitle:h} - - - - -{styles:h} -{topScripts:h} - - -
-
-
- - - -
- {mainNav:h} -
- -
-
-
- {toolboxContent:h} -
-
- -
    -
  • AAD
  • -
  • ABD
  • -
  • ACMS
  • -
  • ASDS
  • -
- -
-
-{bottomScripts:h} - + + + + + + + {pageTitle:h} + {styles:h} + + + + + {topScripts:h} + + +
+
+ + {if:isHomePage} +
+ {else:} +
+ {end:} + +
+
+ + + + + + + +
+
+ +
+ + + + + + + +
+
+ +
+
+

A World of Things to Do!

+
+

+ Adventure through boreal forests long beaches of sands and magnificent rocks. Experience stunning sunrises and sunsets that will fill your eyes. See historic architecture, friendly villages and majestic panoramas. The wild is here, yet mixed with a culture of people who thrive in it. +

+
+
+
+ {if:!isHomePage} + {if:toolboxContent.breadCrumbs} + {toolboxContent.breadCrumbs:h} + + {end:} + {end:} + + +
+ + +
+ + +
+
+

A World of Things to See!

+
+

+ Seek your extreme adventure right here! Epic hikes and biking. Snowfall, ski hills and snowmobile and water trails everywhere. Lake Superior cliffs, mines and caves all waiting to be discovered and visit the hundreds of freshwater shipwrecks. +

+
+
+
+
+ + +
+ +
+
+
+ +
+
+

Get the Keweenaw Adventure Guide and Others!

+ +
+
+
+
+ +

View our Videos

+
+
+
+ + Find more about Weather in Houghton, MI +
+
+ +
+
    +
  • 56638 Calumet Avenue, Calumet, MI 49913
  • +
  • (888) 766-0325 • 906-337-4579
  • +
  • info@keweenaw.info
  • +
+
+ + +
+ +
+
+ +
+
+ + {bottomScripts:h} + + + + diff --git a/templates/toolbox.html b/templates/toolbox.html new file mode 100644 index 0000000..ad0eebb --- /dev/null +++ b/templates/toolbox.html @@ -0,0 +1,67 @@ +{if:isHomePage} + +

{toolboxContent.primaryParagraph[title]}

+The Keweenaw is Michigan’s Copper Country! Here is where the largest fresh waters on earth create a peninsula called the Keweenaw. Where adventure falls from the sky, grows from the ground and springs from Lake Superior. + +{else:} + +
+ {if:toolboxContent.primaryParagraph[image]} +
+ {toolboxContent.primaryParagraph[image]:h} +
+
+

{toolboxContent.primaryParagraph[title]}

+ {toolboxContent.primaryParagraph[description]:h} +
+ {else:} +
+

{toolboxContent.primaryParagraph[title]}

+ {toolboxContent.primaryParagraph[description]:h} +
+ {end:} +
+ +{if:toolboxContent.profile} + {toolboxContent.profile:h} +{end:} + +{if:toolboxContent.searchForm} + {toolboxContent.searchForm:h} +{end:} + +{if:toolboxContent.searchResults} + {toolboxContent.searchResults:h} +{end:} + +{if:toolboxContent.staticPageContent} +
+
+ {toolboxContent.staticPageContent:h} +
+
+{end:} +{if:toolboxContent.photos} +{toolboxContent.photos:h} +{end:} + +
+ {if:section[image]} +
+ {section[image]:h} +
+
+

{section[title]}

+ {section[description]:h} + {section[files]:h} +
+ {else:} +
+

{section[title]}

+ {section[description]:h} + {section[files]:h} +
+ {end:} +
+ +{end:} \ No newline at end of file