TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-03-2009, 07:24 AM   #1 (permalink)
The Visitor
Newcomer 
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
arale is on a distinguished road
Confused Next/Previous navigation problem

Hi,

I get a php function for Next Previous navigation menu like below code. The result, it shows like this



But I want to add ... between the numbers and change the position of previous, next button like this



How to modifly the code below to make it works?

code:
PHP Code:
function get_letter_page_nav($letter 'A'$curpage 1$updown 0) {
    
$lastIndex get_last_index($letter);
    
$html '<div class="pagination">';
    
$i 1;
    if (
$curpage == $i) {
        
$is_first ' class="current"';
    } else {
        
$is_first '';
    }
    
$html .= '<a '.$is_first.' href="'.KAY_SITE.'/letter/'.$letter.'" title="Front Page of Letter '.$letter.'">'.$i.'</a>';

    for (
$i 2$i <= $lastIndex$i++) {
        if (
$curpage == $i) {
            
$curstyle ' class="current"';
        } else {
            
$curstyle '';   
        }
        
$html .= '<a '.$curstyle.' href="'.KAY_SITE.'/letter/'.$letter.'/'.$i.'" title="Page '.$i.' of Letter '.$letter.'">'.$i.'</a>';
    }
    
$html .= '';
   
    
$html2 '';
    if (
$curpage == 1) {
        if (
$lastIndex == 1) {
            
$html2 .= '<span class="disabled">&laquo; Previous</span>';
            
$html2 .= '<span class="disabled">Next &raquo;</span>';
        } else {
            
$next_page $curpage 1;
            
$html2 .= '<span class="disabled">&laquo; Previous</span>';
            
$html2 .= "<a href=\"".KAY_SITE."/letter/$letter/$next_page\" title=\"Next Page\">Next &raquo;</a>";
        }
    } elseif (
$curpage == $lastIndex) {
        
$prev_page $curpage 1;
        
$html2 .= "<a href=\"".KAY_SITE."/letter/$letter/$prev_page\" title=\"Previous Page\">&laquo; Previous</a>";
        
$html2 .= '<span class="disabled">Next &raquo;</span>';
    } else {
        
$next_page $curpage 1;
        
$prev_page $curpage 1;
        
$html2 .= "<a href=\"".KAY_SITE."/letter/$letter/$prev_page\" title=\"Previous Page\">&laquo; Previous</a>";
        
$html2 .= "<a href=\"".KAY_SITE."/letter/$letter/$next_page\" title=\"Next Page\">Next &raquo;</a>";
    }
    
$html2 .= '</div>';
   
    if (
$updown) {
        
$html $html2.$html;
    } else {
        
$html $html.$html2;
    }
   
    return 
$html;

thank you for your help,
arale
arale is offline  
Reply With Quote
Old 07-03-2009, 03:27 PM   #2 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,216
Thanks: 17
Village Idiot is on a distinguished road
Default

As a general rule for asking help, never just say "make this code work" and expect people to do the work for you. We are willing to help you fix it, but we need more information on the matter.

What is the issue with the code your presented? Where does it not work? What have you already tried?
Village Idiot is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem getting data on the html table.... jetnet1 General 2 11-24-2008 05:55 PM
Huge Session Problem Killswitch General 1 11-17-2008 01:36 AM
Problem with Query + While $a = mysql_fetch_array($b) Aaron Absolute Beginners 0 07-03-2008 07:16 PM
A serious curl checkbox problem bedri Advanced PHP Programming 1 05-22-2008 04:25 PM
A bug or a cache problem?! yazid Advanced PHP Programming 0 05-22-2008 08:40 AM


All times are GMT. The time now is 09:10 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design