if($itemCount > $config['page_item_per_page'])
{
// paging code
$mx=round($itemCount / $config['page_item_per_page']);
if($begin<($config['page_item_per_page']*5))
{
$start =0;
}
else
{
$start=( round($begin / $config['page_item_per_page']) -5 ) ;
$body .='<a class="page_btn" href=\''.$link .'/0/'.$config['page_item_per_page'].'\'>1</a>';
}
$forcount=0;
for($i=$start ; $i<=$mx;$i++)
{
$forcount++;
$body .=($i!=0 ? '::':'');
if(($i * $config['page_item_per_page'])==$begin)
{
$body .= '<span class="page_btn_disabled">'.($i+1).'</span>' ;
continue;
}
$body .='<a class="page_btn" href=\''.$link.($i* $config['page_item_per_page']).
'/'.($i+1)*$config['page_item_per_page'].'\'>'.
($i+1).'</a>';
if($forcount>10)
$i+=round( sqrt($mx));
if(($i-$mx)>3 )
{
$body .='::<a class="page_btn" href=\''.$link.(($mx-1)* ($config['page_item_per_page'])).
'/'.$itemCount.'\'>'.
($mx) .'</a>';
}
}//for
$body .= ' <script>
var step = '.$config['page_item_per_page'].';
var url = "'.$link.'";
function goPage(num)
{
document.location = url + ((num-1)*step ) + "/" +(num*step );
}
</script>
::<input type="text" style="width:50px" id="txtGo" value="1" /><a class="page_btn" href="javascript:void(0)" onclick="goPage(txtGo.value)">Go</a>';
}//if
return $body;
}
`
Please format the code you posted, by wrapping it in triple backticks. -> `
Обсуждают сегодня