diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 459ebc78f..717f00f4f 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -879,8 +879,10 @@ class news_shortcodes extends e_shortcode { $array['types'] = 'news,page'; } - - return e107::getForm()->renderRelated($array, $this->news_item['news_meta_keywords'], array('news'=>$this->news_item['news_id'])); + + $template = e107::getTemplate('news', 'news', 'related'); + + return e107::getForm()->renderRelated($array, $this->news_item['news_meta_keywords'], array('news'=>$this->news_item['news_id']),$template); } diff --git a/e107_core/templates/menu_template.php b/e107_core/templates/menu_template.php index add3df824..c4d8635e1 100644 --- a/e107_core/templates/menu_template.php +++ b/e107_core/templates/menu_template.php @@ -1,23 +1,26 @@ <?php +if (!defined('e107_INIT')) { exit; } +#### Panel Template - Used by menu_class.php for Custom Menu Content. +#### Additional control over image thumbnailing is possible via SETIMAGE e.g. {SETIMAGE: w=200&h=150&crop=1} -#### Panel Template - Used by menu_class.php for Custom Menu Content. - - - $MENU_TEMPLATE['default']['start'] = ''; + $MENU_TEMPLATE['default']['start'] = '<div class="cpage-menu {CMENUNAME}">'; $MENU_TEMPLATE['default']['body'] = '{CMENUBODY}'; - $MENU_TEMPLATE['default']['end'] = ''; + $MENU_TEMPLATE['default']['end'] = '</div>'; - $MENU_TEMPLATE['button']['start'] = '<div class="cpage-menu">'; + $MENU_TEMPLATE['button']['start'] = '<div class="cpage-menu {CMENUNAME}">'; $MENU_TEMPLATE['button']['body'] = '<div>{CMENUBODY}</div>{CPAGEBUTTON}'; $MENU_TEMPLATE['button']['end'] = '</div>'; - ### Additional control over image thumbnailing is possible via SETIMAGE e.g. {SETIMAGE: w=200&h=150&crop=1} - $MENU_TEMPLATE['buttom-image']['start'] = '<div class="cpage-menu">'; + $MENU_TEMPLATE['buttom-image']['start'] = '<div class="cpage-menu {CMENUNAME}">'; $MENU_TEMPLATE['buttom-image']['body'] = '<div>{CMENUIMAGE}</div>{CPAGEBUTTON}'; - $MENU_TEMPLATE['buttom-image']['end'] = '</div>'; + $MENU_TEMPLATE['buttom-image']['end'] = '</div>'; - $MENU_TEMPLATE['image-only']['start'] = ''; - $MENU_TEMPLATE['image-only']['body'] = '{CMENUIMAGE}'; - $MENU_TEMPLATE['image-only']['end'] = ''; + $MENU_TEMPLATE['image-only']['start'] = '<div class="cpage-menu {CMENUNAME}">'; + $MENU_TEMPLATE['image-only']['body'] = '{CMENUIMAGE}'; + $MENU_TEMPLATE['image-only']['end'] = '</div>'; + + $MENU_TEMPLATE['image-text-button']['start'] = '<div class="cpage-menu {CMENUNAME}">'; + $MENU_TEMPLATE['image-text-button']['body'] = '{CMENUIMAGE}{CMENUBODY}{CPAGEBUTTON}'; + $MENU_TEMPLATE['image-text-button']['end'] = '</div>'; ?> \ No newline at end of file diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index fd88d2abf..e8c9dc393 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -2876,7 +2876,7 @@ class e_form * @param string $tags : comma separated list of keywords to return related items of. * @param array $curVal. eg. array('page'=> current-page-id-value); */ - function renderRelated($parm,$tags, $curVal) //XXX TODO Cache! + function renderRelated($parm,$tags, $curVal, $template=null) //XXX TODO Cache! { if(empty($tags)) @@ -2895,6 +2895,19 @@ class e_form { $parm['types'] = 'news'; } + + if(empty($template)) + { + $TEMPLATE['start'] = "<hr><h4>".defset('LAN_RELATED', 'Related')."</h4><ul class='e-related'>"; + $TEMPLATE['item'] = "<li><a href='{RELATED_URL}'>{RELATED_TITLE}</a></li>"; + $TEMPLATE['end'] = "</ul>"; + + } + else + { + $TEMPLATE = $template; + } + $tp = e107::getParser(); @@ -2902,7 +2915,8 @@ class e_form $types = explode(',',$parm['types']); $list = array(); - + $head = $tp->parseTemplate($TEMPLATE['start'],true); + foreach($types as $plug) { @@ -2919,15 +2933,25 @@ class e_form { foreach($tmp as $val) { - $list[] = "<li><a href='".$tp->replaceConstants($val['url'],'full')."'>".$val['title']."</a></li>"; - + + $row = array( + 'RELATED_URL' => $tp->replaceConstants($val['url'],'full'), + 'RELATED_TITLE' => $val['title'], + 'RELATED_IMAGE' => $tp->toImage($val['image']), + 'RELATED_SUMMARY' => $tp->toHtml($val['summary'],true,'BODY') + ); + + $list[] = $tp->simpleParse($TEMPLATE['item'], $row); + } } } if(count($list)) { - return "<div class='e-related clearfix hidden-print'><hr><h4>".defset('LAN_RELATED', 'Related')."</h4><ul class='e-related'>".implode("\n",$list)."</ul></div>"; //XXX Tablerender? + return "<div class='e-related clearfix hidden-print'>".$head.implode("\n",$list).$tp->parseTemplate($TEMPLATE['end'], true)."</div>"; + + // return "<div class='e-related clearfix hidden-print'><hr><h4>".defset('LAN_RELATED', 'Related')."</h4><ul class='e-related'>".implode("\n",$list)."</div>"; //XXX Tablerender? } } diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index f275af76a..ac9b8fced 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -478,11 +478,11 @@ class e_menu $page_shortcodes = e107::getScBatch('page',null,'cpage'); $page_shortcodes->setVars($page); - $head = $tp->parseTemplate($template['start'], true); - $foot = $tp->parseTemplate($template['end'], true); + $head = $tp->parseTemplate($template['start'], true, $page_shortcodes); + $foot = $tp->parseTemplate($template['end'], true, $page_shortcodes); // print_a($template['body']); - $text = $head.$tp->parseTemplate($template['body'], true, $page_shortcodes).$template['end']; + $text = $head.$tp->parseTemplate($template['body'], true, $page_shortcodes).$foot; // echo "TEMPLATE= ($mpath)".$page['menu_template']; diff --git a/e107_plugins/news/e_related.php b/e107_plugins/news/e_related.php index e661431e4..534d0e7c8 100644 --- a/e107_plugins/news/e_related.php +++ b/e107_plugins/news/e_related.php @@ -32,11 +32,13 @@ class news_related // include plugin-folder in the name. { while($row = $sql->fetch()) { + $thumbs = !empty($row['news_thumbnail']) ? explode(",",$row['news_thumbnail']) : array(); + $items[] = array( 'title' => varset($row['news_title']), 'url' => e107::getUrl()->create('news/view/item',$row), // '{e_BASE}news.php?extend.'.$row['news_id'], - 'body' => varset($row['news_summary']), - 'image' => varset($row['news_image']) + 'summary' => varset($row['news_summary']), + 'image' => $thumbs[0] ); } diff --git a/e107_plugins/news/templates/news_template.php b/e107_plugins/news/templates/news_template.php index c9b7dd054..17cbb2ef4 100644 --- a/e107_plugins/news/templates/news_template.php +++ b/e107_plugins/news/templates/news_template.php @@ -196,4 +196,12 @@ $NEWS_TEMPLATE['category']['item'] = ' </td></tr> </table> </div> -'; \ No newline at end of file +'; + +### Related 'start' - Options: Core 'single' shortcodes including {SETIMAGE} +### Related 'item' - Options: {RELATED_URL} {RELATED_IMAGE} {RELATED_TITLE} {RELATED_SUMMARY} +### Related 'end' - Options: Options: Core 'single' shortcodes including {SETIMAGE} + +$NEWS_TEMPLATE['related']['start'] = "<hr><h4>".defset('LAN_RELATED', 'Related')."</h4><ul class='e-related'>"; +$NEWS_TEMPLATE['related']['item'] = "<li><a href='{RELATED_URL}'>{RELATED_TITLE}</a></li>"; +$NEWS_TEMPLATE['related']['end'] = "</ul>"; diff --git a/e107_plugins/page/e_related.php b/e107_plugins/page/e_related.php index 162b77e71..69491c174 100644 --- a/e107_plugins/page/e_related.php +++ b/e107_plugins/page/e_related.php @@ -72,8 +72,8 @@ class page_related // replace 'e_' with 'plugin-folder_' $items[] = array( 'title' => $title, 'url' => e107::getUrl()->create('page/view/index',$row), // '{e_BASE}news.php?extend.'.$row['news_id'], - 'body' => $row['news_summary'], - 'image' => $row['news_image'] + 'summary' => $row['page_metadescr'], + 'image' => $row['menu_image'] ); }