* Next > Previous to show 10 news items per page, etc, without having to build a ton of pages
* Sort by year
I'm sure there's more, but that's all I can think of now

Hopefully they can tie into something generic like the Pager package in PEAR.Patricia wrote: Actually, the pagination is already something in a feature request in the forge for the core,
for content and content modules. And I think it's even already attributed to a dev![]()
Code: Select all
$query .= "(".$db->IfNull('start_time',"'".$db->DBTimeStamp(1)."'")." < '".$db->DBTimeStamp(time())."') ";
$query .= "((".$db->IfNull('end_time',"'".$db->DBTimeStamp(1)."'")." = '".$db->DBTimeStamp(1)."') OR (end_time > '".$db->DBTimeStamp(time())."'))
#ADD these lines
$qq=preg_replace('/SELECT .+ FROM/','SELECT COUNT(*) as total FROM',$query);
$dbr =& $db->Execute($qq);
$rr = $dbr->FetchRow();</b>
$total=$rr['total'];
...
#SUBSTITUTE old code
$dbresult = '';
$number = -1;
if( isset( $params['number'] ) )
{
$number = $params['number'];
}
$inicio=$_GET['inicio']*$number;
$start = -1;
if( isset( $params['start'] ) )
{
$start = $params['start'];
}
if ($_GET['inicio']>0) {
$start=$_GET['inicio']*$number;
}
if( $start >= 0 || $number >= 0 )
{
$dbresult =& $db->SelectLimit($query, $number, $start);
}
else
{
$dbresult =& $db->Execute($query);
}
while ($dbresult && $row = $dbresult->FetchRow())
{
....
$onerow->author = $theuser->username;
$onerow->id = $row['news_id'];
#ADD these lines
$onerow->start = $start;
$onerow->number = $number;
$onerow->total = $total;
$onerow->inicio = $inicio;
Code: Select all
{/foreach}
<!-- End News Display Template -->
{php}
#ADD this code snippet
$eu=$_SERVER['REQUEST_URI'];
$sem=preg_replace('/\&inicio=.+$/','',$eu);
if ($start<0) $start=0;
for ($f=0;$f<($total/$number);$f++) {
if ($start!=$f*$number)
echo "<a href='$sem&inicio=".$f."'>".($f+1)."</a> ";
else
echo '['.($f+1).'] ';
}
{/php}