日期:2014-05-17 浏览次数:20525 次
$sql = "SELECT * FROM `links` WHERE `subdomain` != '' ORDER BY id desc LIMIT 100";
$rows = $db->getData($sql);
foreach($rows as $row)
{
echo '<li><a href="http://'.$row['subdomain'].'.abc.com/" title="'.$row['title'].'">'.$row['title'].'</a></li>';
}
class CCustomWidgets {
public static function Pager($totalPages, $pageNumber, $pageSize, $url, $displayNumber = 6) {
$baseUrl = (strpos($url, "?") === false) ? $url.'?page=' : $url.'&page=';
$pager = '<div class="pager"><ul>';
$prevPage = $pageNumber - 1;
if($prevPage > 0){
$pager .= '<li><a href="'.$baseUrl. $prevPage.'"><span class="pager-previous">?????€é?μ</span></a></li>';
}
if($totalPages - $pageNumber < $displayNumber) {
$displayStart = ($totalPages >= $displayNumber) ? ($totalPages - $displayNumber + 1) : 1;
$displayEnd = $totalPages;
}else{
if($pageNumber % $displayNumber){
$displayStart = floor($pageNumber / $displayNumber) * $displayNumber + 1;
$displayEnd = (floor($pageNumber / $displayNumber) + 1) * $displayNumber;
}else{
$displayStart = (floor(($pageNumber / $displayNumber) - 1)) * $displayNumber + 1;
$displayEnd = (floor($pageNumber / $displayNumber)) * $displayNumber;
}
}
for(; $displayStart <= $displayEnd; $displayStart++) {
$pager .= '<li><a href="'.$baseUrl.$displayStart.'"><span '.(($pageNumber == $displayStart) ? 'class="active"' : '').'>'.$displayStart.'</span></a></li>';
}
if($pageNumber < $totalPages){
$pager .= '<li><a href="'.$baseUrl. ($pageNumber + 1) .'"><span class="pager-next">?????€é?μ</span></a></li>';
}
$pager .= "</ul></div>";
return $pager;
}
}