Jump to content

Help with centering paging in IE..


dannel77

Recommended Posts

Hi,

I'm having a small problem with this paging script I'm using, it looks alright in Firefox but IE tilts it to the left, could anyone please tell me how to get it centered in Internet Explorer as well.. Pasting only the part of the script where (I guess) I need to make the changes:

// Hämta länk till förstasidan och föregående sida
if ($start > 0) {
$numlink = '<a href="?start=0&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">««</a> ';
$numlink .= '<a href="?start='.($start - $limit).'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">«</a> ';
} else {
$numlink = '«« ';
$numlink .= '« ';
}

// Hämta sidonummer
for ($i = 1; $i <= $pages; $i++) {
$newoffset = $limit*($i-1);
if ($start == $newoffset)
$numlink .= '['.$i.'] ';
else
$numlink .= '<a href="?start='.$newoffset.'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">'.$i.'</a> ';
}

// Hämta länk till nästa sida
if ($numrows > ($start + $limit))
$numlink .= '<a href="?start='.($start + $limit).'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">»</a> ';
else
$numlink .= '» ';

// Hämta sista sidan
if ($start != $newoffset)
$numlink .= '<a href="?start='.$newoffset.'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">»»</a> ';
else
$numlink .= '»» ';

Any help really appreciated! :)
Link to comment
Share on other sites

Thanks alot man! I couldn't just cut and paste, but eventually it worked out.. Here is how it looks now:

&nbsp;<center>
<?php

// database connection
mysql_connect("$host","$user","$pass");

// database selection
mysql_select_db("$database");

// Nu bestämmer vi antal per sida och kollar vi upp totala antalet
$limit = 30; // Antal per sida
$result = @mysql_query("SELECT count(*) as count FROM products WHERE maingroup = '$maingroup' AND secondgroup = '$secondgroup'")

or die("Error fetching number in DB<br>".mysql_error());
$row = @mysql_fetch_array($result);
$numrows = $row['count']; // Antal i databasen

// Sedan kollar vi om startvariabeln är satt
if (!isset($_GET['start']) || $_GET['start'] == "")
$start = 0;
else
$start = $_GET['start'];

// Då räknar vi ut hur många sidor det blev
$pages = intval($numrows/$limit);
if ($numrows%$limit)
$pages++;

// Hämta länk till förstasidan och föregående sida
if ($start > 0) {
$numlink = '<a href="?start=0&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">««</a> ';
$numlink .= '<a href="?start='.($start - $limit).'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">«</a> ';
} else {
$numlink = '«« ';
$numlink .= '« ';
}

// Hämta sidonummer
for ($i = 1; $i <= $pages; $i++) {
$newoffset = $limit*($i-1);
if ($start == $newoffset)
$numlink .= '['.$i.'] ';
else
$numlink .= '<a href="?start='.$newoffset.'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">'.$i.'</a> ';
}

// Hämta länk till nästa sida
if ($numrows > ($start + $limit))
$numlink .= '<a href="?start='.($start + $limit).'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">»</a> ';
else
$numlink .= '» ';

// Hämta sista sidan
if ($start != $newoffset)
$numlink .= '<a href="?start='.$newoffset.'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">»»</a> ';
else
$numlink .= '»» ';

// Skriv ut sidorna
echo $numlink;

// Nu kan vi hämta datan från databasen och skriva ut den
$result = @mysql_query("SELECT * FROM products WHERE maingroup = '$maingroup' AND secondgroup = '$secondgroup' ORDER BY item ASC LIMIT $start, $limit")
or die("Error fetching data<br>".mysql_error());

while ($row = @mysql_fetch_array($result)){
$color = ($coloralternator++ %2 ? "D5E2EC" : "EBF1F5");
echo "<TR BGCOLOR=\"#$color\"><TD ALIGN=\"middle\"><a href=\"item_show.php?code_no=$row[2]\" TARGET=\"main\"><IMG SRC=\"thumbs/$row[6]\" BORDER=\"0\"></a></TD>";
echo "<TD ALIGN=\"left\"><font style=\"font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif;\"><a href=\"item_show.php?code_no=$row[2]\" TARGET=\"main\"> $row[2] </FONT></TD>";
echo "<TD ALIGN=\"left\"></a><font style=\"font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif;\"><a href=\"item_show.php?code_no=$row[2]\" TARGET=\"main\"> $row[3] </FONT></TD>";
echo "<TD ALIGN=\"right\"></a><font style=\"font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif;\"> $row[5] </font></TD>";
echo "<TD ALIGN=\"middle\"> <INPUT TYPE=\"hidden\" NAME=\"id$row[2]quant\" VALUE=\"1\">
<a href=\"Javascript:top.center.cart.addItem('$row[3]','$row[5]', document.itemsform.id$row[2]quant.value, '$row[2]', '$row[7]')\"><img src=\"images/buy.gif\" border=\"0\"></a> </TD></TR>";
}
"</center>"
?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.