Page 1 of 1

php array().....

Posted: Mon Mar 26, 2007 9:10 am
by texxarse
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi!
Can someone help me please? I got completely lost... Dunno why I can't finish my code. I've got it like:

Code: Select all

if ($this->mrTotalPages > 1)                           
    {    
       // read the query string                            
       $query_string = $_SERVER['QUERY_STRING'];           
       // find if we have PageNo in the query string       
       $pos = stripos($query_string, "PageNo=");           
       // if there is no PageNo in the query string        
       // then we're on the first page                     
       if ($pos == false)                                  
       {                                                   
         $query_string .= "&PageNo=1";                     
         $pos = stripos($query_string, "PageNo=");         
       }                    
       // read the current page number from the query string
       $temp = substr($query_string, $pos);
       sscanf($temp, "PageNo=%d", $this->mPageNo);
       // build the Next link
       if ($this->mPageNo >= $this->mrTotalPages)
         $this->mNextLink = "";
       else                 
       {                    
         $new_query_string = str_replace("PageNo=" . $this->mPageNo, 
                         "PageNo=" . ($this->mPageNo + 1), $query_string);
         $this->mNextLink = "index.php?".$new_query_string;
       }                    
       // build the Previous link
       if ($this->mPageNo == 1)
         $this->mPreviousLink = "";
       else                 
       {                    
         $new_query_string = str_replace("PageNo=" . $this->mPageNo, 
                         "PageNo=" . ($this->mPageNo - 1), $query_string);
         $this->mPreviousLink = "index.php?".$new_query_string;
       }
    }
and what i wanna do is, separate pages from 1-???. i mean, i've got a page which shows there is 12 pages and i got navigation links Next and Previous but its really bad when i am on page 11 for example and i wanna jump back to page 2. so if someone knows how to write code for it i'll be very happy. im new in php and i dont understand everything. thanx


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Mar 26, 2007 10:13 am
by Begby
Do a search on the forums or interweb for 'pagination' or 'paginate'