dannel77 Posted March 31, 2006 Share Posted March 31, 2006 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 sidaif ($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 sidonummerfor ($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 sidaif ($numrows > ($start + $limit)) $numlink .= '<a href="?start='.($start + $limit).'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">»</a> ';else $numlink .= '» '; // Hämta sista sidanif ($start != $newoffset) $numlink .= '<a href="?start='.$newoffset.'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">»»</a> ';else $numlink .= '»» ';Any help really appreciated! :) Quote Link to comment Share on other sites More sharing options...
shortj75 Posted April 1, 2006 Share Posted April 1, 2006 put this at the top of your code[code]echo "<center>";[/code]put this at the bottom of your code[code]echo "</center>";[/code]and that should center you page Quote Link to comment Share on other sites More sharing options...
dannel77 Posted April 1, 2006 Author Share Posted April 1, 2006 Thanks alot man! I couldn't just cut and paste, but eventually it worked out.. Here is how it looks now: <center><?php// database connectionmysql_connect("$host","$user","$pass");// database selectionmysql_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 sattif (!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 sidaif ($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 sidonummerfor ($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 sidaif ($numrows > ($start + $limit)) $numlink .= '<a href="?start='.($start + $limit).'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">»</a> ';else $numlink .= '» '; // Hämta sista sidanif ($start != $newoffset) $numlink .= '<a href="?start='.$newoffset.'&maingroup='.$maingroup.'&secondgroup='.$secondgroup.'">»»</a> ';else $numlink .= '»» ';// Skriv ut sidornaecho $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>"?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.