mirror of
https://github.com/e107inc/e107.git
synced 2025-07-09 17:16:20 +02:00
Added new e_related addon and updated default news and page templates to utilize.
This commit is contained in:
@ -527,5 +527,17 @@ class news_shortcodes extends e_shortcode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function sc_newsrelated($array=array())
|
||||||
|
{
|
||||||
|
if(!varset($array['types']))
|
||||||
|
{
|
||||||
|
$array['types'] = 'news,page';
|
||||||
|
}
|
||||||
|
|
||||||
|
return e107::getForm()->renderRelated($array['types'], $this->news_item['news_meta_keywords'], array('news'=>$this->news_item['news_id']));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -372,7 +372,15 @@ class cpage_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function sc_cpagerelated($array=array())
|
||||||
|
{
|
||||||
|
if(!varset($array['types']))
|
||||||
|
{
|
||||||
|
$array['types'] = 'page,news';
|
||||||
|
}
|
||||||
|
|
||||||
|
return e107::getForm()->renderRelated($array['types'], $this->page['page_metakeys'], array('page'=>$this->page['page_id']));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ $sc_style['CPAGENAV|default']['post'] = '</div>';
|
|||||||
#### default template - BC ####
|
#### default template - BC ####
|
||||||
// used only for parsing comment outside of the page tablerender-ed content
|
// used only for parsing comment outside of the page tablerender-ed content
|
||||||
// leave empty if you integrate page comments inside the main page template
|
// leave empty if you integrate page comments inside the main page template
|
||||||
|
|
||||||
|
|
||||||
$PAGE_TEMPLATE['default']['page'] = '
|
$PAGE_TEMPLATE['default']['page'] = '
|
||||||
{PAGE}
|
{PAGE}
|
||||||
{PAGECOMMENTS}
|
{PAGECOMMENTS}
|
||||||
@ -39,7 +41,6 @@ $sc_style['CPAGENAV|default']['post'] = '</div>';
|
|||||||
$PAGE_TEMPLATE['default']['body'] = '
|
$PAGE_TEMPLATE['default']['body'] = '
|
||||||
{CPAGEMESSAGE|default}
|
{CPAGEMESSAGE|default}
|
||||||
|
|
||||||
<div class="f-right">{CPAGEAUTHOR|default}{CPAGEDATE|default}</div>
|
|
||||||
{CPAGESUBTITLE|default}
|
{CPAGESUBTITLE|default}
|
||||||
<div class="clear"><!-- --></div>
|
<div class="clear"><!-- --></div>
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ $sc_style['CPAGENAV|default']['post'] = '</div>';
|
|||||||
';
|
';
|
||||||
|
|
||||||
// always used
|
// always used
|
||||||
$PAGE_TEMPLATE['default']['end'] = '</div>';
|
$PAGE_TEMPLATE['default']['end'] = '{CPAGERELATED: types=page,news}</div>';
|
||||||
|
|
||||||
// options per template - disable table render
|
// options per template - disable table render
|
||||||
// $PAGE_TEMPLATE['default']['noTableRender'] = false; //XXX Deprecated
|
// $PAGE_TEMPLATE['default']['noTableRender'] = false; //XXX Deprecated
|
||||||
@ -91,7 +92,6 @@ $sc_style['CPAGENAV|default']['post'] = '</div>';
|
|||||||
';
|
';
|
||||||
|
|
||||||
$PAGE_TEMPLATE['custom']['end'] = '</div>';
|
$PAGE_TEMPLATE['custom']['end'] = '</div>';
|
||||||
// $PAGE_TEMPLATE['custom']['noTableRender'] = true; //XXX Deprecated
|
|
||||||
$PAGE_TEMPLATE['custom']['tableRender'] = '';
|
$PAGE_TEMPLATE['custom']['tableRender'] = '';
|
||||||
|
|
||||||
|
|
||||||
|
@ -2229,6 +2229,49 @@ class e_form
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render Related Items for the current page/news-item etc.
|
||||||
|
* @param string $type : comma separated list. ie. plugin folder names.
|
||||||
|
* @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($type='news',$tags, $curVal) //XXX TODO Cache!
|
||||||
|
{
|
||||||
|
$parm = array('limit' => 5);
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
$types = explode(',',$type);
|
||||||
|
|
||||||
|
foreach($types as $plug)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!$obj = e107::getAddon($plug,'e_related'))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parm['current'] = intval(varset($curVal[$plug]));
|
||||||
|
|
||||||
|
$tmp = $obj->compile($tags,$parm);
|
||||||
|
|
||||||
|
if(count($tmp))
|
||||||
|
{
|
||||||
|
foreach($tmp as $val)
|
||||||
|
{
|
||||||
|
$list[] = "<li><a href='".$tp->replaceConstants($val['url'],'full')."'>".$val['title']."</a></li>";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($list))
|
||||||
|
{
|
||||||
|
return "<div class='e-related'><hr><h4>Related</h4><ul class='e-related'>".implode("\n",$list)."</ul></div>"; //XXX Tablerender?
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render Table cells from field listing.
|
* Render Table cells from field listing.
|
||||||
|
@ -135,6 +135,7 @@ $NEWS_TEMPLATE['view']['item'] = '
|
|||||||
<span class="category ">{GLYPH=comments} {NEWSCOMMENTCOUNT} {EMAILICON} {PRINTICON} {PDFICON} {ADMINOPTIONS}</span>
|
<span class="category ">{GLYPH=comments} {NEWSCOMMENTCOUNT} {EMAILICON} {PRINTICON} {PDFICON} {ADMINOPTIONS}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{NEWSRELATED}
|
||||||
';
|
';
|
||||||
//$NEWS_MENU_TEMPLATE['view']['separator'] = '<br />';
|
//$NEWS_MENU_TEMPLATE['view']['separator'] = '<br />';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user