12-09-2007, 02:27 PM
|
#19 (permalink)
|
|
The Contributor
Join Date: Oct 2007
Location: Argentina
Posts: 72
Thanks: 18
|
Quote:
Originally Posted by crazyryan
Thanks for the advice, I have one more problem.
My site uses mod_rewrite on the category pages and I want to apply pagination, will that be a problem? My .htaccess code is RewriteRule "^category/([0-9]+).html$" category.php?id=$1 [Last]
And my PHP code is
PHP Code:
<?php
$query = mysql_query("select * from games where catid = '$id' limit 0,10");
while($row = mysql_fetch_array($query)) {
$url = '/game/' . strtolower(str_replace('--', '-', str_replace(' ', '-', preg_replace('/[^\sA-Za-z0-9]+/', '', $row['title'])))) . '-' . $row['id'] . '.html';
echo '<p style="margin-bottom: 10px;"><img src="' . $row['thumbnail'] . '" style="float: left; margin-right: 10px;" />
<strong><a href="' . $url . '">' . $row['title'] . '</a></strong> - <small>Played ' . $row['plays'] . ' times!</small><br />
' . $row['description'] . '</p>';
}
?>
I'm not sure if this will conflict if I use pagination and what not?
Any help?
|
You could try this:
RewriteRule ^category/([0-9]+)/page\-([0-9]+)\.html$ category.php?id=$1&page=$2 [L,QSA]
and have the following URLs:
/category/1/page-1.html
Of course you will need to work on the query to make the pagination work. Talk a look at this tutorial or this one (more advanced).
|
|
|
|