From 34832f22872aabad8b49f457cda0e332e2c7d950 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 15 Aug 2014 10:39:47 -0400 Subject: [PATCH] Update for caching Update to cache the serialized array from the paragraph part --- Toolkit/Template/Page/Toolbox.php | 32 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Toolkit/Template/Page/Toolbox.php b/Toolkit/Template/Page/Toolbox.php index 6745c88..04e58b5 100644 --- a/Toolkit/Template/Page/Toolbox.php +++ b/Toolkit/Template/Page/Toolbox.php @@ -387,7 +387,7 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody $cache = $this->cache->get("paragraphs-$id", 'Toolbox'); if ($cache) { - return $cache; + return unserialize($cache); } else { $sections = array(); $page = $this->pageGateway->find($id); @@ -422,28 +422,24 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody break; } -// $html = ''; $linksFormat = '%s'; foreach ($paragraphs as $paragraph) { if ($paragraph['active']) { $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']); + $sect['image'] + = $this->getParagraphImage($paragraph, $side[$key]); + $sect['description'] + = $this->keywordReplacement-> + findAndReplace($paragraph['description']); + $sect['files'] + = $this->getParagraphFiles($paragraph['files']); if ($paragraph['back_to_top']) { - $sect['back_to_top'] = 'Back to Top'; -// $html .= 'Back to Top'; + $sect['back_to_top'] + = 'Back to Top'; } -// $html .= '
'; - $this->paragraphLinks[] = sprintf( $linksFormat, $paragraph['id'], @@ -454,8 +450,11 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody } } - $this->cache->save($html, "paragraphs-$id", 'Toolbox'); -// return $html; + $this->cache->save( + serialize($sections), + "paragraphs-$id", + 'Toolbox' + ); return $sections; } } @@ -488,4 +487,3 @@ class Toolkit_Template_Page_Toolbox implements Toolkit_Template_Page_IBody // }}} } -?> -- 2.17.1