".$s_linkText." "; if(is_array($s_formID) && $s_formID[0]== "location") { $s_url = $n_pageNum != $s_formID[1] ? $s_link."/".$n_pageNum : $s_link; } else if(is_array($s_formID) && $s_formID[0]== "search") { $s_url = $s_link."&page=".$n_pageNum; } else if(is_string($s_link)) { $s_url = $n_pageNum != "1" ? $s_link."/".$n_pageNum : $s_link; } else $s_url = $n_pageNum != "1" ? $s_link."/".$n_pageNum : $s_link; return "".$s_linkText." "; } function getPageLinks($n_pageNum, $n_totalPages, $n_nearbyPages, $s_link, $s_separator = "..", $s_formID = "", $n_seoNumLinks = "5") { $n_seoNumLinks +=1; $s_result = ""; if ($n_nearbyPages == 0) { // in some cases, show all page links $n_nearbyStart = 1; $n_nearbyPages = $n_totalPages - 1; } else { if ($n_nearbyPages % 2 == 0) $n_nearbyStart = $n_pageNum - $n_nearbyPages / 2 + 1; else $n_nearbyStart = $n_pageNum - floor($n_nearbyPages / 2); if ($n_nearbyStart + $n_nearbyPages - 1 > $n_totalPages) $n_nearbyStart = $n_totalPages - $n_nearbyPages + 1; if ($n_nearbyStart < 1) $n_nearbyStart = 1; } $n_nearbyEnd = $n_nearbyStart + $n_nearbyPages - 1; // show 1... if we're far away from page 1 if ($n_nearbyStart > 1) $s_result .= getPageLink(1, $n_pageNum, $s_link, $s_formID); if ($n_nearbyStart > 2) $s_result .= $s_separator." "; //show seo link pages $n_seoLinkIncr=floor(($n_nearbyStart-1)/$n_seoNumLinks); if($n_seoLinkIncr >= 3) { $n_seoStart=1+$n_seoLinkIncr; $n_seoEnd=$n_nearbyStart-$n_seoLinkIncr; for ($i = $n_seoStart; $i <= $n_seoEnd; $i+=$n_seoLinkIncr) $s_result .= getPageLink($i, $n_pageNum, $s_link, $s_formID).$s_separator." "; } // show nearby pages for ($i = $n_nearbyStart; $i <= $n_nearbyEnd && $i <= $n_totalPages; $i++) $s_result .= getPageLink($i, $n_pageNum, $s_link, $s_formID); // show ...X if we're far away from the last page if ($n_nearbyEnd < $n_totalPages - 1) $s_result .= $s_separator." "; //show seo link pages $n_seoLinkIncr=floor(($n_totalPages-$n_nearbyEnd)/$n_seoNumLinks); if($n_seoLinkIncr >= 3) { $n_seoStart=$n_nearbyEnd+$n_seoLinkIncr; $n_seoEnd=$n_totalPages-$n_seoLinkIncr; for ($i = $n_seoStart; $i <= $n_seoEnd; $i+=$n_seoLinkIncr) $s_result .= getPageLink($i, $n_pageNum, $s_link, $s_formID).$s_separator." "; } # hide last page #if ($n_nearbyEnd < $n_totalPages) # $s_result .= self::getPageLink($n_totalPages, $n_pageNum, $s_link, $s_formID); //show last page if($n_nearbyEnd < $n_totalPages) $s_result .= getPageLink($n_totalPages, $n_pageNum, $s_link, $s_formID); return $s_result; } function getLbl($labelName) { global $LABELS, $LANG_CODE; return $LABELS[$LANG_CODE][$labelName]; } function shortenString($string, $limit) { if ((strlen($string)) > $limit) { $string = substr ($string,0,$limit); if ((substr($string,-1)) != "") { for($i=0; $i <= $limit; $i++) { if ((substr($string,-2-$i,1)) == " "){ $string = substr($string, 0, $limit-1-$i); return $string; } } } } else { return $string; } } ?>