From 247579c41e7919c60ef8e30443db620cf76d6ac2 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 18 Dec 2012 01:32:33 -0800 Subject: [PATCH] Custom-Page navigation menu and shortcode added. --- e107_core/templates/navigation_template.php | 15 ++-- e107_core/templates/page_template.php | 99 +++++++++++++++++++-- e107_handlers/sitelinks_class.php | 9 +- e107_plugins/page/e_sitelink.php | 26 ++---- 4 files changed, 115 insertions(+), 34 deletions(-) diff --git a/e107_core/templates/navigation_template.php b/e107_core/templates/navigation_template.php index ef0e7053b..d380686a2 100644 --- a/e107_core/templates/navigation_template.php +++ b/e107_core/templates/navigation_template.php @@ -88,7 +88,7 @@ $NAVIGATION_TEMPLATE['side']['start'] = ' $NAVIGATION_TEMPLATE['side']['submenu_start'] = ''; -$NAVIGATION_TEMPLATE['side']['submenu_item'] = '
  • {LINK_NAME}
  • - '; +$NAVIGATION_TEMPLATE['side']['submenu_item'] = '
  • {LINK_NAME}
  • '; -$NAVIGATION_TEMPLATE['side']['submenu_item_active'] = '
  • {LINK_NAME}
  • - '; +$NAVIGATION_TEMPLATE['side']['submenu_loweritem'] = ' + +'; + +$NAVIGATION_TEMPLATE['side']['submenu_item_active'] = '
  • {LINK_NAME}
  • '; $NAVIGATION_TEMPLATE['side']['submenu_end'] = ''; diff --git a/e107_core/templates/page_template.php b/e107_core/templates/page_template.php index 5da2ca6e8..32e825daa 100644 --- a/e107_core/templates/page_template.php +++ b/e107_core/templates/page_template.php @@ -1,10 +1,15 @@ '; $PAGE_TEMPLATE['panel']['restricted'] = ''; $PAGE_TEMPLATE['panel']['end'] = ''; $PAGE_TEMPLATE['panel']['noTableRender'] = false; - $PAGE_TEMPLATE['panel']['tableRender'] = ''; +// $PAGE_TEMPLATE['panel']['tableRender'] = ''; // needed? + + +/* Used by {PAGE_NAVIGATION} shortcode - uses Sitelink/Navigation Shortcodes eg. {LINK_NAME} */ + + $PAGE_TEMPLATE['nav']['caption'] = "Articles"; + + $PAGE_TEMPLATE['nav']['start'] = ''; + + $PAGE_TEMPLATE['nav']['item_active'] = ' +
  • + + {LINK_IMAGE} {LINK_NAME} + +
  • + '; + + $PAGE_TEMPLATE['nav']['end'] = ''; + + + $PAGE_TEMPLATE['nav']['submenu_start'] = ''; diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index bf66d2b24..be3a04d6f 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -1407,10 +1407,8 @@ class e_navigation $sc = e107::getScBatch('navigation'); $sc->template = $template; $ret = $template['start']; - - foreach ($data as $_data) - { + { $sc->setVars($_data); $active = ($this->isActive($_data)) ? "_active" : ""; $itemTmpl = count($_data['link_sub']) > 0 ? $template['item_submenu'.$active] : $template['item'.$active]; @@ -1529,6 +1527,11 @@ class navigation_shortcodes extends e_shortcode { return e107::getParser()->toHtml($this->var['link_name'],false,'defs'); } + + function sc_link_parent($parm='') + { + return intval($this->var['link_parent']); + } function sc_link_url($parm='') { diff --git a/e107_plugins/page/e_sitelink.php b/e107_plugins/page/e_sitelink.php index fc2ea9e71..1963b8b37 100644 --- a/e107_plugins/page/e_sitelink.php +++ b/e107_plugins/page/e_sitelink.php @@ -2,28 +2,14 @@ /* * e107 website system * - * Copyright (C) 2008-2009 e107 Inc (e107.org) + * Copyright (C) 2008-2013 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * - * Sitelinks configuration module - gsitemap - * - * $Source: /cvs_backup/e107_0.8/e107_plugins/page/e_sitelink.php,v $ - * $Revision$ - * $Date$ - * $Author$ - * */ -//require_once("../../class2.php"); + if (!defined('e107_INIT')) { exit; } -/*if(!plugInstalled('gsitemap')) -{ - return; -}*/ -//$pg = new page_sitelinks; -//$pg->myfunction(); - class page_sitelinks // include plugin-folder in the name. { @@ -47,7 +33,7 @@ class page_sitelinks // include plugin-folder in the name. $sql = e107::getDb(); $sublinks = array(); $arr = array(); - $query = "SELECT p.*, c.* FROM #page AS p LEFT JOIN #page_chapters AS c ON p.page_chapter = c.chapter_id ORDER BY c.chapter_order,p.page_order"; + $query = "SELECT p.*, c.* FROM #page AS p LEFT JOIN #page_chapters AS c ON p.page_chapter = c.chapter_id ORDER BY c.chapter_order,p.page_order"; $data = $sql->retrieve($query, true); foreach($data as $row) @@ -56,7 +42,7 @@ class page_sitelinks // include plugin-folder in the name. $sublinks[$pid][] = array( 'link_id' => $row['page_id'], 'link_name' => $row['page_title'], - 'link_url' => 'page.php?'.$row['page_id'], + 'link_url' => vartrue($row['page_sef'],'page.php?'.$row['page_id']), 'link_description' => '', 'link_button' => '', 'link_category' => '', @@ -67,7 +53,7 @@ class page_sitelinks // include plugin-folder in the name. ); } - $books = $sql->retrieve("page_chapters","*",1, true); + $books = $sql->retrieve("page_chapters","*", 1, true); foreach($books as $row) { @@ -75,7 +61,7 @@ class page_sitelinks // include plugin-folder in the name. $arr[] = array( 'link_id' => $row['chapter_id'], 'link_name' => $row['chapter_name'], - 'link_url' => 'page.php?'.$row['chapter_id'], + 'link_url' => vartrue($row['chapter_sef'],'#'), 'link_description' => '', 'link_button' => '', 'link_category' => '',