Well im using a pagination script found here:
http://www.strangerstudios.com/sandbox/pagination/diggstyle.php
And the page im using it on is here:
http://www.whatcouldicook.com/vegetarian.php
The trouble is my dreamweaver generated code starts at page number 0 and not 1 as the script wants. How would I change it?
The vegetarian.php code:
<?php require_once('wordpress/wp-config.php');
require_once('wordpress/wp-includes/wp-db.php');
require_once('wordpress/wp-includes/pluggable.php');
require('includes/connection.php');
require('includes/pagination.php');
require('_drawratingmenu.php');?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_dsRecipes = 10;
$page = 0;
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$startRow_dsRecipes = $page * $maxRows_dsRecipes;
mysql_select_db($database_dsRecipes, $dsRecipes);
$query_dsRecipes = "SELECT Title, SmallDesc, id, picturesmall FROM recipes WHERE Vegetarian=1 ORDER BY Created_at DESC";
$query_limit_dsRecipes = sprintf("%s LIMIT %d, %d", $query_dsRecipes, $startRow_dsRecipes, $maxRows_dsRecipes);
$dsRecipes = mysql_query($query_limit_dsRecipes, $dsRecipes) or die(mysql_error());
$row_dsRecipes = mysql_fetch_assoc($dsRecipes);
if (isset($_GET['totalRows_dsRecipes'])) {
$totalRows_dsRecipes = $_GET['totalRows_dsRecipes'];
} else {
$all_dsRecipes = mysql_query($query_dsRecipes);
$totalRows_dsRecipes = mysql_num_rows($all_dsRecipes);
}
$totalPages_dsRecipes = ceil($totalRows_dsRecipes/$maxRows_dsRecipes)-1;
$queryString_dsRecipes = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "page") == false &&
stristr($param, "totalRows_dsRecipes") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_dsRecipes = "&" . htmlentities(implode("&", $newParams));
}
}
<div id="content">
<div id="title">
<h2>There are <span class="num"><?php echo $totalRows_dsRecipes ?> </span> Vegetarian recipes, showing recipes <span class="num"><?php echo ($startRow_dsRecipes + 1) ?> to <?php echo min($startRow_dsRecipes + $maxRows_dsRecipes, $totalRows_dsRecipes) ?></span></h2>
</div>
</div>
<?php do { ?>
<div class="method">
<h2><?php echo htmlentities($row_dsRecipes['Title']); ?></h2> <?php $recipeID = $row_dsRecipes['id']; echo rating_bar("$recipeID",'5', 'static'); ?>
<p><a href="/recipe/<?php echo $row_dsRecipes['id']; ?>"><img src="<?php echo $row_dsRecipes['picturesmall']; ?>" name="recipeimg" class="recipeimg" alt="<?php echo htmlentities($row_dsRecipes['Title']); ?>" /></a></p>
<p><?php echo htmlentities($row_dsRecipes['SmallDesc']); ?></p>
<p><a href="/recipe/<?php echo $row_dsRecipes['id']; ?>" class="link">Click here to view</a></p>
</div>
<?php } while ($row_dsRecipes = mysql_fetch_assoc($dsRecipes)); ?>
<br />
</div>
<div class="love">
<?php echo getPaginationString($page, $totalRows_dsRecipes, $maxRows_dsRecipes, $adjacents, '/vegetarian.php', '?page='); ?>
</div>
<div id="clear"></div>
<div id="footer">