i’d like a basic idea of how to go about formatting the following paging of the search result.
this is the paging code:
//Create and print the Navigation bar
$nav="";
$next = $page+1;
$prev = $page-1;
if($page > 1) {
$nav .= "<div class=\"search_mainpg\"><div class=\"searchpage\" style=\"width:5%;\"><a onclick=\"showPage('','$prev'); return false;\" href=\"$self?page=" . $prev . "&q=" .urlencode($search_result) . "\">< Prev</a></div>";
$first = "<div class=\"searchpage\" style=\"width:2%;\"><a onclick=\"showPage('','1'); return false;\" href=\"$self?page=1&q=" .urlencode($search_result) . "\"> << </a></div>" ;
}
else {
$nav .= " ";
$first = " ";
}
for($i = 1 ; $i <= $numpages ; $i++) {
if($i == $page) {
$nav .= "<b>$i</b>";
}else{
$nav .= "<div class=\"searchpage\" style=\"width:2%;\"><a onclick=\"showPage('',$i); return false;\" href=\"$self?page=" . $i . "&q=" .urlencode($search_result) . "\">$i</a></div>";
}
}
if($page < $numpages) {
$nav .= "<div class=\"searchpage\" style=\"width:5%;\"><a onclick=\"showPage('','$next'); return false;\" href=\"$self?page=" . $next . "&q=" .urlencode($search_result) . "\">Next ></a></div>";
$last = "<div class=\"searchpage\" style=\"width:2%;\"><a onclick=\"showPage('','$numpages'); return false;\" href=\"$self?page=$numpages&q=" .urlencode($search_result) . "\"> >> </a></div></div>";
}
else {
$nav .= " ";
$last = " ";
}
echo $first . $nav . $last;
currently, it displays like this:
alt text http://img227.imageshack.us/img227/2765/paginate.jpg
Try changing the
<div>tags to<span>instead.divis a block tag, whereasspanis inline. Think like<p></p>versus<i></i>where the one is designed to put space above & blow the content, the other just modifies the view.One other thing, is that you use
<b>$i</b>to bold the current one. This should also be aspanordivor whatever you’re using, so you can easily modify it by CSS later on.