Jump to content


Photo

Functions.php


  • Please log in to reply
No replies to this topic

#1 Micah

Micah

    Colonel

  • [[Administrators]]
  • PipPipPipPipPip
  • 2,290 posts

Posted 02 August 2003 - 11:55 PM

/*-------------------------------------------------------------------------*/
// Build up page span links
/*-------------------------------------------------------------------------*/

function build_pagelinks($data)
{
global $ibforums, $skin_universal;

$work = array();

$section = ($data['leave_out'] == "") ? 2 : $data['leave_out']; // Number of pages to show per section( either side of current), IE: 1 ... 4 5 [6] 7 8 ... 10

$work['pages'] = 1;

if ( ($data['TOTAL_POSS'] % $data['PER_PAGE']) == 0 )
{
$work['pages'] = $data['TOTAL_POSS'] / $data['PER_PAGE'];
}
else
{
$number = ($data['TOTAL_POSS'] / $data['PER_PAGE']);
$work['pages'] = ceil( $number);
}


$work['total_page'] = $work['pages'];
$work['current_page'] = $data['CUR_ST_VAL'] > 0 ? ($data['CUR_ST_VAL'] / $data['PER_PAGE']) + 1 : 1;


if ($work['pages'] > 1)
{
//Line 848!!
$work['first_page'] = $skin_universal->make_page_jump($data['TOTAL_POSS'],$data['PER_PAGE'], $data['BASE_URL'])." (".$work['pages'].")";

for( $i = 0; $i <= $work['pages'] - 1; ++$i )
{
$RealNo = $i * $data['PER_PAGE'];
$PageNo = $i+1;

if ($RealNo == $data['CUR_ST_VAL'])
{
$work['page_span'] .= " [{$PageNo}]";
}
else
{

if ($PageNo < ($work['current_page'] - $section))
{
$work['st_dots'] = " lang['ps_page']} 1'>« {$ibforums->lang['ps_first']} ...";
continue;
}

// If the next page is out of our section range, add some dotty dots!

if ($PageNo > ($work['current_page'] + $section))
{
$work['end_dots'] = "... lang['ps_page']} {$work['pages']}'>{$ibforums->lang['ps_last']} »";
break;
}


$work['page_span'] .= " {$PageNo}";
}
}

$work['return'] = $work['first_page'].$work['st_dots'].$work['page_span'].' '.$work['end_dots'];
}
else
{
$work['return'] = $data['L_SINGLE'];
}

return $work['return'];
}

Attached Files