View Single Post
  #1 (permalink)  
Old 07-02-09, 11:03 PM
arale arale is offline
Newbie Coder
 
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Question Next Previous navigation problem

Hi,

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

http://img406.imageshack.us/img406/8118/nav1.gif

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

http://img391.imageshack.us/img391/4103/nav2k.gif

How to modifly the code below to make it works?

code:
php 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
Attached Images
  
__________________
Zend decode is possible!
www.zendecode.com
Reply With Quote