mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
Menu Template fixes and enhancements. Related News now has a template.
This commit is contained in:
parent
51d59f83d9
commit
d30135e026
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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>';
|
||||
?>
|
@ -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?
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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'];
|
||||
|
||||
|
||||
|
@ -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]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -196,4 +196,12 @@ $NEWS_TEMPLATE['category']['item'] = '
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
';
|
||||
';
|
||||
|
||||
### 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>";
|
||||
|
@ -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']
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user