1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

News are using nextprev templates now (new nextprev feature)

This commit is contained in:
secretr
2011-11-29 14:16:24 +00:00
parent e5e8a73eb6
commit 48b9ceb5d2

View File

@@ -2,7 +2,7 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2011 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
@@ -88,6 +88,31 @@ Variables Used:
$ix = new news;
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
// URL settings (nextprev)
$newsUrlparms = array('page' => '--FROM--');
if($sub_action)
{
switch ($action)
{
case 'list':
$newsUrlparms['id'] = $sub_action;
$newsRoute = 'list/category';
break;
case 'cat':
$newsUrlparms['id'] = $sub_action;
$newsRoute = 'list/short';
break;
default:
$newsRoute = 'list/items';
break;
}
}
else $newsRoute = 'list/items';
$newsRoute = 'news/'.$newsRoute;
//------------------------------------------------------
// DISPLAY NEWS IN 'CATEGORY' FORMAT HERE
//------------------------------------------------------
@@ -199,15 +224,18 @@ if ($action == 'cat' || $action == 'all')
$text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param);
}
$amount = ($action == "all") ? NEWSALL_LIMIT : NEWSLIST_LIMIT;
$icon = ($row['category_icon']) ? "<img src='".e_IMAGE."icons/".$row['category_icon']."' alt='' />" : "";
// Deprecated.
// $parms = $news_total.",".$amount.",".$newsfrom.",".$e107->url->getUrl('core:news', 'main', "action=nextprev&to_action={$action}&subaction={$category}");
$parms = $news_total.",".$amount.",".$newsfrom.",".e_SELF.'?'.$action.".".$category.".[FROM]";
$text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
// $parms = $news_total.",".$amount.",".$newsfrom.",".e_SELF.'?'.$action.".".$category.".[FROM]";
//
// $text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
$amount = ($action == "all") ? NEWSALL_LIMIT : NEWSLIST_LIMIT;
$nitems = defined('NEWS_NEXTPREV_NAVCOUNT') ? '&navcount='.NEWS_NEXTPREV_NAVCOUNT : '' ;
$url = rawurlencode(e107::getUrl()->create($newsRoute, $newsUrlparms));
$parms = 'tmpl_prefix='.deftrue('NEWS_NEXTPREV_TMPL', 'default').'&total='.$news_total.'&amount='.$amount.'&current='.$newsfrom.$nitems.'&url='.$url;
$text .= $tp->parseTemplate("{NEXTPREV={$parms}}");
if(!$NEWSLISTTITLE)
{
@@ -615,9 +643,17 @@ if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(
// $parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".$e107->url->getUrl('core:news', 'main', "action=nextprev&to_action=".($action ? $action : 'default' )."&subaction=".($sub_action ? $sub_action : "0"));
$sub_action = intval($sub_action);
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
$text .= ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
// $parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
$amount = ITEMVIEW;
$nitems = defined('NEWS_NEXTPREV_NAVCOUNT') ? '&navcount='.NEWS_NEXTPREV_NAVCOUNT : '' ;
$url = rawurlencode(e107::getUrl()->create($newsRoute, $newsUrlparms));
$parms = 'tmpl_prefix='.deftrue('NEWS_NEXTPREV_TMPL', 'default').'&total='.$news_total.'&amount='.$amount.'&current='.$newsfrom.$nitems.'&url='.$url;
$text .= $tp->parseTemplate("{NEXTPREV={$parms}}");
// $nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
// $text .= ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
// $text=''.$text.'<center>'.$nextprev.'</center>';
echo $text;
@@ -661,10 +697,16 @@ else
$i++;
}
$sub_action = intval($sub_action);
$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
$amount = ITEMVIEW;
$nitems = defined('NEWS_NEXTPREV_NAVCOUNT') ? '&navcount='.NEWS_NEXTPREV_NAVCOUNT : '' ;
$url = rawurlencode(e107::getUrl()->create($newsRoute, $newsUrlparms));
$parms = 'tmpl_prefix='.deftrue('NEWS_NEXTPREV_TMPL', 'default').'&total='.$news_total.'&amount='.$amount.'&current='.$newsfrom.$nitems.'&url='.$url;
echo $tp->parseTemplate("{NEXTPREV={$parms}}");
// $parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
// $nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
// echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
$cache_data = ob_get_clean();
require_once(HEADERF);