Changeset 643
- Timestamp:
- Dec 13, 2004, 11:54:44 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/config.inc.php
r642 r643 190 190 // to the sub level 191 191 $conf['level_separator'] = ' / '; 192 193 // paginate_pages_around : on paginate navigation bar, on many pages display 194 // before and after the current page ? 195 $conf['paginate_pages_around'] = 2; 192 196 ?> -
trunk/include/functions_html.inc.php
r642 r643 55 55 } 56 56 57 function create_navigation_bar( $url, $nb_element, $start, 58 $nb_element_page, $link_class ) 59 { 60 global $lang; 61 $navigation_bar = ""; 62 // 0. détection de la page en cours 63 if( !isset( $start ) 64 || !is_numeric( $start ) 65 || ( is_numeric( $start ) && $start < 0 ) ) 57 function create_navigation_bar($url, $nb_element, $start, 58 $nb_element_page, $link_class) 59 { 60 global $lang, $conf; 61 62 $pages_around = $conf['paginate_pages_around']; 63 64 $navigation_bar = ''; 65 66 // current page detection 67 if (!isset($start) 68 or !is_numeric($start) 69 or (is_numeric($start) and $start < 0)) 66 70 { 67 71 $start = 0; 68 72 } 69 // on n'affiche la bare de navigation que si on plus de 1 page 70 if ( $nb_element > $nb_element_page ) 71 { 72 // 1.une page précédente ? 73 74 // navigation bar useful only if more than one page to display ! 75 if ($nb_element > $nb_element_page) 76 { 77 // searching the current page 78 $cur_page = ceil($start / $nb_element_page) + 1; 79 $maximum = ceil($nb_element / $nb_element_page); 80 81 // link to first page ? 82 if ($cur_page != 1) 83 { 84 $navigation_bar.= '<a href="'; 85 $navigation_bar.= add_session_id($url.'&start=0'); 86 $navigation_bar.= '" class="'.$link_class.'">'.$lang['first_page']; 87 $navigation_bar.= '</a>'; 88 } 89 else 90 { 91 $navigation_bar.= $lang['first_page']; 92 } 93 $navigation_bar.= ' | '; 94 // link on previous page ? 73 95 if ( $start != 0 ) 74 96 { … … 78 100 $navigation_bar.= '" class="'.$link_class.'">'.$lang['previous_page']; 79 101 $navigation_bar.= '</a>'; 80 $navigation_bar.= ' | '; 81 } 82 // 2.liste des numéros de page 83 $maximum = ceil ( $nb_element / $nb_element_page ); 84 for ( $i = 1; $i <= $maximum; $i++ ) 85 { 86 $temp_start = ( $i - 1 ) * $nb_element_page; 87 if ( $temp_start == $start ) 102 } 103 else 104 { 105 $navigation_bar.= $lang['previous_page']; 106 } 107 $navigation_bar.= ' | '; 108 109 if ($cur_page > $pages_around + 1) 110 { 111 $navigation_bar.= ' <a href="'; 112 $navigation_bar.= add_session_id($url.'&start=0'); 113 $navigation_bar.= '" class="'.$link_class.'">1</a> ...'; 114 } 115 116 // inspired from punbb source code 117 for ($i = $cur_page - $pages_around, $stop = $cur_page + $pages_around + 1; 118 $i < $stop; 119 $i++) 120 { 121 if ($i < 1 or $i > $maximum) 88 122 { 89 $navigation_bar.= ' <span class="pageNumberSelected">'.$i.'</span> '; 123 continue; 124 } 125 else if ($i != $cur_page) 126 { 127 $temp_start = ($i - 1) * $nb_element_page; 128 $navigation_bar.= ' <a href="'; 129 $navigation_bar.= add_session_id($url.'&start='.$temp_start); 130 $navigation_bar.= '" class="'.$link_class.'">'.$i.'</a>'; 90 131 } 91 132 else 92 133 { 93 $navigation_bar.= ' <a href="'; 94 $navigation_bar.= add_session_id( $url.'&start='.$temp_start ); 95 $navigation_bar.= '" class="'.$link_class.'">'.$i.'</a> '; 134 $navigation_bar.= ' <span class="pageNumberSelected">'; 135 $navigation_bar.= $i.'</span>'; 96 136 } 97 137 } 98 // 3.une page suivante ? 138 139 if ($cur_page < ($maximum - $pages_around)) 140 { 141 $temp_start = ($maximum - 1) * $nb_element_page; 142 $navigation_bar.= ' ... <a href="'; 143 $navigation_bar.= add_session_id($url.'&start='.$temp_start); 144 $navigation_bar.= '" class="'.$link_class.'">'.$maximum.'</a>'; 145 } 146 147 $navigation_bar.= ' | '; 148 // link on next page ? 99 149 if ( $nb_element > $nb_element_page 100 150 && $start + $nb_element_page < $nb_element ) 101 151 { 102 152 $next = $start + $nb_element_page; 103 $navigation_bar.= ' |<a href="';153 $navigation_bar.= '<a href="'; 104 154 $navigation_bar.= add_session_id( $url.'&start='.$next ); 105 155 $navigation_bar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>'; 156 } 157 else 158 { 159 $navigation_bar.= $lang['next_page']; 160 } 161 // link to last page ? 162 if ($cur_page != $maximum) 163 { 164 $temp_start = ($maximum - 1) * $nb_element_page; 165 $navigation_bar.= ' | '; 166 $navigation_bar.= '<a href="'; 167 $navigation_bar.= add_session_id($url.'&start='.$temp_start); 168 $navigation_bar.= '" class="'.$link_class.'">'.$lang['last_page']; 169 $navigation_bar.= '</a>'; 170 } 171 else 172 { 173 $navigation_bar.= $lang['last_page']; 106 174 } 107 175 } -
trunk/language/en_UK.iso-8859-1/common.lang.php
r630 r643 205 205 $lang['previous_page'] = 'Previous'; 206 206 $lang['next_page'] = 'Next'; 207 $lang['first_page'] = 'First'; 208 $lang['last_page'] = 'Last'; 207 209 $lang['recent_image'] = 'Image within the'; 208 210 $lang['days'] = 'days';
Note: See TracChangeset
for help on using the changeset viewer.