From 9618771f432328504e550066a1a33afcc92d0c44 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 28 Jan 2015 00:06:18 -0800 Subject: [PATCH] Tweaked the search results on 'Pages'. --- e107_plugins/page/e_search.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/e107_plugins/page/e_search.php b/e107_plugins/page/e_search.php index 92ee7e509..58c229984 100644 --- a/e107_plugins/page/e_search.php +++ b/e107_plugins/page/e_search.php @@ -111,16 +111,31 @@ class page_search extends e_search // include plugin-folder in the name. { $row['page_sef'] = '--sef-not-assigned--'; } + + + if($row['page_chapter'] == 0) // Page without category. + { + $route = 'page/view/other'; + $pre = ''; + } + else // Page with book/chapter + { + $route = 'page/view/index'; + $pre = $tp->toHtml($this->getName($book),false,'TITLE').' » '. $tp->toHtml($this->getName($row['page_chapter']),false,'TITLE'). " | "; + } + $res = array(); - $res['link'] = str_replace('///','/', e107::getUrl()->create('page/view', $row, array('allow' => 'page_sef,page_title,page_id,chapter_sef,book_sef'))); - $res['pre_title'] = $tp->toHtml($this->getName($book),false,'TITLE').' - '. $tp->toHtml($this->getName($row['page_chapter']),false,'TITLE'). " | "; + $res['link'] = e107::getUrl()->create($route, $row, array('allow' => 'page_sef,page_title,page_id,chapter_sef,book_sef')); + $res['pre_title'] = $pre; $res['title'] = $tp->toHtml($row['page_title'], false, 'TITLE'); $res['summary'] = (!empty($row['page_metadscr'])) ? $row['page_metadscr'] : $row['page_text']; $res['detail'] = LAN_SEARCH_3.$tp->toDate($row['page_datestamp'], "long"); $res['image'] = $row['menu_image']; + + return $res; }