PREV_123_NEXT help curpage??

Discussion in 'PHP' started by cornetofreak, May 19, 2008.

  1. #1
    i have done this to show 1-2-3-4-5-6-7-8 ect ect but i cant get it to add PREV / NEXT either side please help

    this is part of the index file but uses a template system eg index.template.php / search.template.php


    SEARCH.PHP
    // navigation
    	if($_GET['start'] && is_numeric($_GET['start']))
    	{
    		$start=$_GET['start'];
    		$start=((int)($start/$search_count))*$search_count;
    	}
    	else $start=0;
    	$info['curpage']=ceil(($start+1)/$search_count);
    	$info['total_pages']=ceil($info['total_results_count']/$search_count);
    	$navigation=array();
    	$navigation[]='<span class="navi navi_current"> -'.$info['curpage'].'- </span>'."\n";
    	$inc=$dec=$start;
    	$tcnt=0;
    	for($i=0;$i<9;$i++)
    	{
    		$inc+=$search_count;
    		$incp=ceil(($inc+1)/$search_count);
    		$dec-=$search_count;
    		$decp=ceil(($dec+1)/$search_count);
    		if($inc<$info['total_results_count'])
    		{
    			array_push($navigation,'<span class="navi"> <a href="./?q='.$_GET['q'].'&start='.$inc.'"&type='.$_GET['type'].'>'.$incp.'</a> </span> '."\n");
    			$tcnt++;
    		}
    		if($dec>=0)
    		{
    			array_unshift($navigation,'<span class="navi"> <a href="./?q='.$_GET['q'].'&start='.$dec.'">'.$decp.'</a> </span> '."\n");
    			$tcnt++;
    		}
    		if($tcnt>=10) break;
    	}
    	$navigation=join("",$navigation);
    	// end navigation	
    PHP:

    SEARCH.TEMPLATE.PHP

    heres the code i use to print my results within the template

        <?
    if(!count($info['results'])) print '<div class="info">No results found </div>';
    else print '<br /><font color="black"><div class="center">'.$navigation.  "</font></div>";
    ?>
    PHP:
    Please helpzzz
     
    cornetofreak, May 19, 2008 IP
  2. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    [FIXED] thanks to onlinesoon

    BIG* thanks goes to him
     
    cornetofreak, May 21, 2008 IP