mirror of
https://github.com/e107inc/e107.git
synced 2025-08-16 03:24:20 +02:00
Issue #4024 - Pagination url option added to News preferences. Select between 'record' (legacy format eg. page=20, page=40 etc) or 'page' numbers (page=1, page=2 etc). Experimental - requires more testing.
This commit is contained in:
@@ -31,6 +31,8 @@ class news_shortcodes extends e_shortcode
|
||||
|
||||
private $imageItem;
|
||||
|
||||
protected $pagination;
|
||||
|
||||
|
||||
// protected $param; // do not enable - erases param. .
|
||||
|
||||
@@ -44,6 +46,8 @@ class news_shortcodes extends e_shortcode
|
||||
|
||||
$this->commentsDisabled = vartrue($pref['comments_disabled']);
|
||||
|
||||
$this->pagination = varset($pref['news_pagination'], 'record');
|
||||
|
||||
if(!empty($pref['comments_engine']))
|
||||
{
|
||||
$this->commentsEngine = $pref['comments_engine'];
|
||||
@@ -1207,7 +1211,16 @@ class news_shortcodes extends e_shortcode
|
||||
{
|
||||
$params = e107::getRegistry('core/news/pagination');
|
||||
|
||||
return e107::getParser()->parseTemplate("{NEXTPREV=".$params."}");
|
||||
parse_str($params,$opts);
|
||||
|
||||
if($this->pagination === 'page')
|
||||
{
|
||||
$opts['type'] = 'page';
|
||||
$opts['total'] = ceil($opts['total'] / $opts['amount']);
|
||||
$opts['current'] = ($opts['current'] / $opts['amount']) + 1;
|
||||
}
|
||||
|
||||
return e107::getParser()->parseTemplate("{NEXTPREV=".http_build_query($opts)."}");
|
||||
|
||||
}
|
||||
|
||||
|
@@ -223,6 +223,7 @@
|
||||
<core name="news_default_template">default</core>
|
||||
<core name="news_list_limit">10</core>
|
||||
<core name="news_newdateheader">0</core>
|
||||
<core name="news_pagination">record</core>
|
||||
<core name="newsposts">10</core>
|
||||
<core name="newsposts_archive">0</core>
|
||||
<core name="newsposts_archive_title"></core>
|
||||
|
Reference in New Issue
Block a user