1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-24 15:13:04 +02:00

Shortcode added: {NEWSNAVLINK} for navigation between news pages.

This commit is contained in:
Cameron
2014-02-04 05:17:08 -08:00
parent 988ce38d60
commit 182233238f
4 changed files with 47 additions and 1 deletions

View File

@@ -155,6 +155,50 @@ class news_shortcodes extends e_shortcode
return ($this->param['trackbackbeforestring'] ? $this->param['trackbackbeforestring'] : '')."<a href='".e107::getUrl()->create('news/view/item', $this->news_item)."'>".$this->param['trackbackstring'].$this->news_item['tb_count'].'</a>'.($this->param['trackbackafterstring'] ? $this->param['trackbackafterstring'] : '');
}
/**
* Render a news navigation link
* @param $parm array
* @example {NEWSNAVLINK: list=all}
*/
function sc_newsnavlink($parm='') //TODO add more options.
{
if(varset($parm['list']) == 'all') // A list of all items - usually headings and thumbnails
{
$url = e107::getUrl()->create('news/list/all');
}
elseif(varset($parm['items']) == 'all') // default page of news items, one after the other. (depending on news prefs)
{
$url = e107::getUrl()->create('news/list/items');
}
elseif(varset($parm['items']) == 'category') // news items for current category.
{
$url = e107::getUrl()->create('news/list/category', $this->news_item);
}
elseif(varset($parm['list']) == 'category') // A list of all items - usually headings and thumbnails from the current category.
{
$url = e107::getUrl()->create('news/list/short', $this->news_item); //default for now.
}
else
{
$url = e107::getUrl()->create('news/list/items'); // default for now.
}
$caption = vartrue($parm['text'],LAN_BACK);
$text = '<ul class="pager">
<li><a href="'.$url.'">'.e107::getParser()->toHtml($caption,false,'defs').'</a></li>
</ul>';
return $text;
}
function sc_newsheader($parm)
{
return $this->sc_newscaticon('src');