session_start();
define("rootDir", "/home/sites/www.deltaplastmachinery.com/web/");
require rootDir."includes/settings.php";
$numItems = 6;
$from = (isset($from)) ? (int)$from : 0;
if (!isset($type)) $type = "1";
if (isset($page)) {
$from = ($page-1)*$numItems;
$cpage = $page-1;
}
$itemsPerLine = 3;
$query = "SELECT count(*) FROM projects WHERE type = '$type'";
$result = @mysql_query($query);
$num_rows = mysql_result($result, 0, 0);
//echo $num_rows;
$query = "SELECT * FROM projects WHERE type = '$type' LIMIT $from, $numItems";
$result = @mysql_query($query);
include "header.php";
?>
=$typeTitles[$type]?> |
|
$i = 0;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
if ($i == 0) echo "";
echo "".$row["title"]."
".$row["description"]." | ";
$i++;
if ($i == $itemsPerLine) $i=0;
if ($i == 0) echo " ";
}
?>
|
if (!empty($cpage)) {
$cpage = (int)$cpage;
//if ($num_rows > ($cpage*$numItems)) mysql_data_seek($result, $cpage*$numItems);
}
else {
$cpage = "0";
}
$num_pages = (ceil($num_rows/$numItems));
$cpage = (int)$cpage;
if (($cpage < 6) || ($num_pages < 11)) {
$startPage = 1;
} else {
if ($cpage +5 < $num_pages) {
$startPage = $cpage - 5;
} else {
$startPage = $num_pages - 9;
}
}
if ($num_pages > $startPage + 9) {
$endPage = $startPage + 9;
} else {
$endPage = $num_pages;
}
?>
|
|
include "footer.php"; ?> |