Forums
This topic is locked
live navigation
Posted 09 Aug 2001 18:39:44
1
has voted
09 Aug 2001 18:39:44 Keith Slater posted:
Yea I know, you're sick of me...I need some help with the live navigation stuff. When I put it in there it takes my repeat region stuff away.. Im not sure why. any help is welcomed
thanks
Keith Slater
Replies
Replied 10 Aug 2001 13:29:10
10 Aug 2001 13:29:10 Tim Green replied:
No, not sick of you <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
I don't understand why this problem occurs, again, I don't have the same problem at all, and I use this set of behaviours probably more than any other.
It could well be another case of looking at the code. I'm wondering if you might have inserted some custom script or something else that could be breaking this ?
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
I don't understand why this problem occurs, again, I don't have the same problem at all, and I use this set of behaviours probably more than any other.
It could well be another case of looking at the code. I'm wondering if you might have inserted some custom script or something else that could be breaking this ?
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 10 Aug 2001 15:14:43
10 Aug 2001 15:14:43 Keith Slater replied:
Here is the code of the WHOLE page
<?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
// *** Restrict Access To Page: Grant or deny access to this page
$KT_authorizedUsers=" admin, user";
$KT_authFailedURL="permissions.php";
$KT_grantAccess=0;
session_start();
if (isset($HTTP_SESSION_VARS["KT_Username"])) {
if (false || !(isset($HTTP_SESSION_VARS["KT_UserAuthorization"])) || $HTTP_SESSION_VARS["KT_UserAuthorization"]=="" || strpos($KT_authorizedUsers, $HTTP_SESSION_VARS["KT_UserAuthorization"])) {
$KT_grantAccess = 1;
}
}
if (!$KT_grantAccess) {
$KT_qsChar = "?";
if (strpos($KT_authFailedURL, "?") $KT_qsChar = "&";
$KT_referrer = $PHP_SELF;
if (strlen($QUERY_STRING) > 0) $KT_referrer .= "?" . $QUERY_STRING;
$KT_authFailedURL = $KT_authFailedURL . $KT_qsChar . "accessdenied=" . urlencode($KT_referrer);
header("Location: $KT_authFailedURL"
exit;
}
?><?php
session_start();
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
$Recordset1__MMColParam = "1";
if (isset($HTTP_SESSION_VARS["KT_Username"]))
{$Recordset1__MMColParam = $HTTP_SESSION_VARS["KT_Username"];}
?><?php
if (isset($myDate)) {
$myDate=$CaricaturePHP->DBDate($myDate);
}
?><?php
$Recordset1=$CaricaturePHP->Execute("SELECT * FROM GALLERY_1 WHERE USER_NAME = '" . ($Recordset1__MMColParam) . "'" or DIE($CaricaturePHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?><?php
$Repeat1__numRows = -1;
$Repeat1__index= 0;
$Recordset1_numRows = $Recordset1_numRows + $Repeat1__numRows;
?>
<?php
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
$Recordset1_total = $Recordset1->RecordCount();
// set the number of rows displayed on this page
if ($Recordset1_numRows < 0) { // if repeat region set to all records
$Recordset1_numRows = $Recordset1_total;
} else if ($Recordset1_numRows == 0) { // if no repeat regions
$Recordset1_numRows = 1;
}
// set the first and last displayed record
$Recordset1_first = 1;
$Recordset1_last = $Recordset1_first + $Recordset1_numRows - 1;
// if we have the correct record count, check the other stats
if ($Recordset1_total != -1) {
$Recordset1_numRows = min($Recordset1_numRows, $Recordset1_total);
$Recordset1_first = min($Recordset1_first, $Recordset1_total);
$Recordset1_last = min($Recordset1_last, $Recordset1_total);
}
?>
<?php $MM_paramName = ""; ?>
<?php
// *** Move To Record and Go To Record: declare variables
$MM_rs = &$Recordset1;
$MM_rsCount = $Recordset1_total;
$MM_size = $Recordset1_numRows;
$MM_uniqueCol = "";
$MM_paramName = "";
$MM_offset = 0;
$MM_atTotal = false;
$MM_paramIsDefined = ($MM_paramName != "" && isset($$MM_paramName));
?>
<?php
// *** Move To Record: handle 'index' or 'offset' parameter
if (!$MM_paramIsDefined && $MM_rsCount != 0) {
// use index parameter if defined, otherwise use offset parameter
if(isset($index)){
$r = $index;
} else {
if(isset($offset)) {
$r = $offset;
} else {
$r = 0;
}
}
$MM_offset = $r;
// if we have a record count, check if we are past the end of the recordset
if ($MM_rsCount != -1) {
if ($MM_offset >= $MM_rsCount || $MM_offset == -1) { // past end or move last
if (($MM_rsCount % $MM_size) != 0) { // last page not a full repeat region
$MM_offset = $MM_rsCount - ($MM_rsCount % $MM_size);
}
else {
$MM_offset = $MM_rsCount - $MM_size;
}
}
}
// move the cursor to the selected record
for ($i=0;!$MM_rs->EOF && ($i < $MM_offset || $MM_offset == -1); $i++) {
$MM_rs->MoveNext();
}
if ($MM_rs->EOF) $MM_offset = $i; // set MM_offset to the last possible record
}
?>
<?php
// *** Move To Record: if we dont know the record count, check the display range
if ($MM_rsCount == -1) {
// walk to the end of the display range for this page
for ($i=$MM_offset; !$MM_rs->EOF && ($MM_size < 0 || $i < $MM_offset + $MM_size); $i++) {
$MM_rs->MoveNext();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if ($MM_rs->EOF) {
$MM_rsCount = $i;
if ($MM_size < 0 || $MM_size > $MM_rsCount) $MM_size = $MM_rsCount;
}
// if we walked off the end, set the offset based on page size
if ($MM_rs->EOF && !$MM_paramIsDefined) {
if (($MM_rsCount % $MM_size) != 0) { // last page not a full repeat region
$MM_offset = $MM_rsCount - ($MM_rsCount % $MM_size);
} else {
$MM_offset = $MM_rsCount - $MM_size;
}
}
// reset the cursor to the beginning
$MM_rs->MoveFirst();
// move the cursor to the selected record
for ($i=0; !$MM_rs->EOF && $i < $MM_offset; $i++) {
$MM_rs->MoveNext();
}
}
?>
<?php
// *** Move To Record: update recordset stats
// set the first and last displayed record
$Recordset1_first = $MM_offset + 1;
$Recordset1_last = $MM_offset + $MM_size;
if ($MM_rsCount != -1) {
$Recordset1_first = $Recordset1_first<$MM_rsCount?$Recordset1_first:$MM_rsCount;
$Recordset1_last = $Recordset1_last<$MM_rsCount?$Recordset1_last:$MM_rsCount;
}
// set the boolean used by hide region to check if we are on the last record
$MM_atTotal = ($MM_rsCount != -1 && $MM_offset + $MM_size >= $MM_rsCount);
?>
<?php
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
$MM_removeList = "&index=";
if ($MM_paramName != "" $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);
?>
<?php
// *** Move To Record: set the strings for the first, last, next, and previous links
$MM_moveFirst="";
$MM_moveLast="";
$MM_moveNext="";
$MM_movePrev="";
$MM_keepMove = $MM_keepBoth; // keep both Form and URL parameters for moves
$MM_moveParam = "index";
// if the page has a repeated region, remove 'offset' from the maintained parameters
if ($MM_size > 1) {
$MM_moveParam = "offset";
if (strlen($MM_keepMove)> 0) {
$params = explode("&", $MM_keepMove);
$MM_keepMove = "";
for ($i=0; $i < sizeof($params); $i++) {
list($nextItem) = explode("=", $params[$i]);
if (strtolower($nextItem) != $MM_moveParam) {
$MM_keepMove.="&".$params[$i];
}
}
if (strlen($MM_keepMove) > 0) $MM_keepMove = substr($MM_keepMove, 1);
}
}
// set the strings for the move to links
if (strlen($MM_keepMove) > 0) $MM_keepMove.="&";
$urlStr = $PHP_SELF."?".$MM_keepMove.$MM_moveParam."=";
$MM_moveFirst = $urlStr."0";
$MM_moveLast = $urlStr."-1";
$MM_moveNext = $urlStr.($MM_offset + $MM_size);
$MM_movePrev = $urlStr.(max($MM_offset - $MM_size,0));
?>
<?php
// *** Logout the current user. false
$KT_Logout = $PHP_SELF . "?KT_Logoutnow=1";
if ($KT_Logoutnow=="1" {
session_start();
session_unregister("KT_Username"
$KT_logoutRedirectPage = "keith/caricaturephp/index.php?id=Studio&id2=Convention&id3=Miscellaneous&id4=Published&id5=Celebrity&id6=Showcase";
// redirect with URL parameters (remove the "KT_Logoutnow" query param).
if ($KT_logoutRedirectPage == "" $KT_logoutRedirectPage = $PHP_SELF;
if (!strpos($KT_logoutRedirectPage, "?" && $QUERY_STRING != "" {
$KT_newQS = "?";
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
if($key != "KT_Logoutnow"{
if (strlen($KT_newQS) > 1) $KT_newQS .= "&";
$KT_newQS .= $key . "=" . urlencode($val);
}
}
if (strlen($KT_newQS) > 1) $KT_logoutRedirectPage .= $KT_newQS;
}
header("Location: $KT_logoutRedirectPage"
exit;
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="740" border="0" align="center">
<tr>
<td height="92">
<div align="center"><a href="www.wordprosys.com"><img src="WPS1.gif" width="108" height="108" border="0"></a></div>
</td>
<td valign="middle" height="92">
<div align="center"><br>
<img src="caricathead3%20copy.gif" width="356" height="64"><br>
</div>
<table width="302" border="0" align="center">
<tr>
<td>
<div align="center"><a href="index.php?id=Studio&id2=Convention&id3=Miscellaneous&id4=Published&id5=Celebrity&id6=Showcase">Forum</a>
- <a href="admin.php">Main</a> - <font size="3"><a href="<?php echo $KT_Logout?>">Logout</a></font></div>
</td>
</tr>
</table>
</td>
<td height="92">
<div align="center"><a href="www.caricature.org"><img src="ncnlogosmall.jpg" width="100" height="72" border="0"></a></div>
</td>
</tr>
<tr>
<td colspan="3">
<div align="center"><br>
</div>
</td>
</tr>
<tr>
<td valign="top" colspan="3" height="476">
<p align="center"><b><a href="addcar.php">Insert a Caricature!</a></b></p>
<p align="center"><b><a href="addcar.php"><br>
</a>Current Gallery:</b><br>
</p>
<form name="form1" action="">
<div align="center"><br>
<table width="425" border="0" align="center">
<?php while (($Repeat1__numRows-- != 0) && (!$Recordset1->EOF))
{
?>
<tr>
<?php
$theLoop=0;
while (($theLoop <3) && (!$Recordset1->EOF)){
$theLoop++;
?>
<td>
<div align="center">
<table width="250" border="0">
<tr>
<td>
<div align="center"> <b>
<?php echo $Recordset1->Fields("CATEGORY"?>
</b> <br>
<img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"><br>
<?php echo $Recordset1->Fields("INFO"?>
<br>
<input type="button" name="edit" value="Edit" onClick="location.href='edit.php?edit=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'">
<input type="button" name="radiobutton" onClick="location.href='delcar2.php?radiobutton=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'" value="Delete" label="Delete">
<br>
</div>
</td>
</tr>
</table>
</div>
<?php
$Recordset1->MoveNext();
}
?>
</td>
</tr>
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
</table>
<br>
</div>
</form>
</td>
</tr>
<tr>
<td valign="top" colspan="3">
<div align="center">
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center">
<?php if ($MM_offset != 0) { ?>
<a href="<?php echo $MM_moveFirst?>"><img src="First.gif" border=0></a>
<?php } // end $MM_offset != 0 ?>
</td>
<td width="31%" align="center">
<?php if ($MM_offset != 0) { ?>
<a href="<?php echo $MM_movePrev?>"><img src="Previous.gif" border=0></a>
<?php } // end $MM_offset != 0 ?>
</td>
<td width="23%" align="center">
<?php if (!$MM_atTotal) { ?>
<a href="<?php echo $MM_moveNext?>"><img src="Next.gif" border=0></a>
<?php } // end !$MM_atTotal ?>
</td>
<td width="23%" align="center">
<?php if (!$MM_atTotal) { ?>
<a href="<?php echo $MM_moveLast?>"><img src="Last.gif" border=0></a>
<?php } // end !$MM_atTotal ?>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
<?php
$Recordset1->Close();
?>
Keith Slater
<?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
// *** Restrict Access To Page: Grant or deny access to this page
$KT_authorizedUsers=" admin, user";
$KT_authFailedURL="permissions.php";
$KT_grantAccess=0;
session_start();
if (isset($HTTP_SESSION_VARS["KT_Username"])) {
if (false || !(isset($HTTP_SESSION_VARS["KT_UserAuthorization"])) || $HTTP_SESSION_VARS["KT_UserAuthorization"]=="" || strpos($KT_authorizedUsers, $HTTP_SESSION_VARS["KT_UserAuthorization"])) {
$KT_grantAccess = 1;
}
}
if (!$KT_grantAccess) {
$KT_qsChar = "?";
if (strpos($KT_authFailedURL, "?") $KT_qsChar = "&";
$KT_referrer = $PHP_SELF;
if (strlen($QUERY_STRING) > 0) $KT_referrer .= "?" . $QUERY_STRING;
$KT_authFailedURL = $KT_authFailedURL . $KT_qsChar . "accessdenied=" . urlencode($KT_referrer);
header("Location: $KT_authFailedURL"
exit;
}
?><?php
session_start();
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
$Recordset1__MMColParam = "1";
if (isset($HTTP_SESSION_VARS["KT_Username"]))
{$Recordset1__MMColParam = $HTTP_SESSION_VARS["KT_Username"];}
?><?php
if (isset($myDate)) {
$myDate=$CaricaturePHP->DBDate($myDate);
}
?><?php
$Recordset1=$CaricaturePHP->Execute("SELECT * FROM GALLERY_1 WHERE USER_NAME = '" . ($Recordset1__MMColParam) . "'" or DIE($CaricaturePHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?><?php
$Repeat1__numRows = -1;
$Repeat1__index= 0;
$Recordset1_numRows = $Recordset1_numRows + $Repeat1__numRows;
?>
<?php
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
$Recordset1_total = $Recordset1->RecordCount();
// set the number of rows displayed on this page
if ($Recordset1_numRows < 0) { // if repeat region set to all records
$Recordset1_numRows = $Recordset1_total;
} else if ($Recordset1_numRows == 0) { // if no repeat regions
$Recordset1_numRows = 1;
}
// set the first and last displayed record
$Recordset1_first = 1;
$Recordset1_last = $Recordset1_first + $Recordset1_numRows - 1;
// if we have the correct record count, check the other stats
if ($Recordset1_total != -1) {
$Recordset1_numRows = min($Recordset1_numRows, $Recordset1_total);
$Recordset1_first = min($Recordset1_first, $Recordset1_total);
$Recordset1_last = min($Recordset1_last, $Recordset1_total);
}
?>
<?php $MM_paramName = ""; ?>
<?php
// *** Move To Record and Go To Record: declare variables
$MM_rs = &$Recordset1;
$MM_rsCount = $Recordset1_total;
$MM_size = $Recordset1_numRows;
$MM_uniqueCol = "";
$MM_paramName = "";
$MM_offset = 0;
$MM_atTotal = false;
$MM_paramIsDefined = ($MM_paramName != "" && isset($$MM_paramName));
?>
<?php
// *** Move To Record: handle 'index' or 'offset' parameter
if (!$MM_paramIsDefined && $MM_rsCount != 0) {
// use index parameter if defined, otherwise use offset parameter
if(isset($index)){
$r = $index;
} else {
if(isset($offset)) {
$r = $offset;
} else {
$r = 0;
}
}
$MM_offset = $r;
// if we have a record count, check if we are past the end of the recordset
if ($MM_rsCount != -1) {
if ($MM_offset >= $MM_rsCount || $MM_offset == -1) { // past end or move last
if (($MM_rsCount % $MM_size) != 0) { // last page not a full repeat region
$MM_offset = $MM_rsCount - ($MM_rsCount % $MM_size);
}
else {
$MM_offset = $MM_rsCount - $MM_size;
}
}
}
// move the cursor to the selected record
for ($i=0;!$MM_rs->EOF && ($i < $MM_offset || $MM_offset == -1); $i++) {
$MM_rs->MoveNext();
}
if ($MM_rs->EOF) $MM_offset = $i; // set MM_offset to the last possible record
}
?>
<?php
// *** Move To Record: if we dont know the record count, check the display range
if ($MM_rsCount == -1) {
// walk to the end of the display range for this page
for ($i=$MM_offset; !$MM_rs->EOF && ($MM_size < 0 || $i < $MM_offset + $MM_size); $i++) {
$MM_rs->MoveNext();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if ($MM_rs->EOF) {
$MM_rsCount = $i;
if ($MM_size < 0 || $MM_size > $MM_rsCount) $MM_size = $MM_rsCount;
}
// if we walked off the end, set the offset based on page size
if ($MM_rs->EOF && !$MM_paramIsDefined) {
if (($MM_rsCount % $MM_size) != 0) { // last page not a full repeat region
$MM_offset = $MM_rsCount - ($MM_rsCount % $MM_size);
} else {
$MM_offset = $MM_rsCount - $MM_size;
}
}
// reset the cursor to the beginning
$MM_rs->MoveFirst();
// move the cursor to the selected record
for ($i=0; !$MM_rs->EOF && $i < $MM_offset; $i++) {
$MM_rs->MoveNext();
}
}
?>
<?php
// *** Move To Record: update recordset stats
// set the first and last displayed record
$Recordset1_first = $MM_offset + 1;
$Recordset1_last = $MM_offset + $MM_size;
if ($MM_rsCount != -1) {
$Recordset1_first = $Recordset1_first<$MM_rsCount?$Recordset1_first:$MM_rsCount;
$Recordset1_last = $Recordset1_last<$MM_rsCount?$Recordset1_last:$MM_rsCount;
}
// set the boolean used by hide region to check if we are on the last record
$MM_atTotal = ($MM_rsCount != -1 && $MM_offset + $MM_size >= $MM_rsCount);
?>
<?php
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
$MM_removeList = "&index=";
if ($MM_paramName != "" $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);
?>
<?php
// *** Move To Record: set the strings for the first, last, next, and previous links
$MM_moveFirst="";
$MM_moveLast="";
$MM_moveNext="";
$MM_movePrev="";
$MM_keepMove = $MM_keepBoth; // keep both Form and URL parameters for moves
$MM_moveParam = "index";
// if the page has a repeated region, remove 'offset' from the maintained parameters
if ($MM_size > 1) {
$MM_moveParam = "offset";
if (strlen($MM_keepMove)> 0) {
$params = explode("&", $MM_keepMove);
$MM_keepMove = "";
for ($i=0; $i < sizeof($params); $i++) {
list($nextItem) = explode("=", $params[$i]);
if (strtolower($nextItem) != $MM_moveParam) {
$MM_keepMove.="&".$params[$i];
}
}
if (strlen($MM_keepMove) > 0) $MM_keepMove = substr($MM_keepMove, 1);
}
}
// set the strings for the move to links
if (strlen($MM_keepMove) > 0) $MM_keepMove.="&";
$urlStr = $PHP_SELF."?".$MM_keepMove.$MM_moveParam."=";
$MM_moveFirst = $urlStr."0";
$MM_moveLast = $urlStr."-1";
$MM_moveNext = $urlStr.($MM_offset + $MM_size);
$MM_movePrev = $urlStr.(max($MM_offset - $MM_size,0));
?>
<?php
// *** Logout the current user. false
$KT_Logout = $PHP_SELF . "?KT_Logoutnow=1";
if ($KT_Logoutnow=="1" {
session_start();
session_unregister("KT_Username"
$KT_logoutRedirectPage = "keith/caricaturephp/index.php?id=Studio&id2=Convention&id3=Miscellaneous&id4=Published&id5=Celebrity&id6=Showcase";
// redirect with URL parameters (remove the "KT_Logoutnow" query param).
if ($KT_logoutRedirectPage == "" $KT_logoutRedirectPage = $PHP_SELF;
if (!strpos($KT_logoutRedirectPage, "?" && $QUERY_STRING != "" {
$KT_newQS = "?";
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
if($key != "KT_Logoutnow"{
if (strlen($KT_newQS) > 1) $KT_newQS .= "&";
$KT_newQS .= $key . "=" . urlencode($val);
}
}
if (strlen($KT_newQS) > 1) $KT_logoutRedirectPage .= $KT_newQS;
}
header("Location: $KT_logoutRedirectPage"
exit;
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="740" border="0" align="center">
<tr>
<td height="92">
<div align="center"><a href="www.wordprosys.com"><img src="WPS1.gif" width="108" height="108" border="0"></a></div>
</td>
<td valign="middle" height="92">
<div align="center"><br>
<img src="caricathead3%20copy.gif" width="356" height="64"><br>
</div>
<table width="302" border="0" align="center">
<tr>
<td>
<div align="center"><a href="index.php?id=Studio&id2=Convention&id3=Miscellaneous&id4=Published&id5=Celebrity&id6=Showcase">Forum</a>
- <a href="admin.php">Main</a> - <font size="3"><a href="<?php echo $KT_Logout?>">Logout</a></font></div>
</td>
</tr>
</table>
</td>
<td height="92">
<div align="center"><a href="www.caricature.org"><img src="ncnlogosmall.jpg" width="100" height="72" border="0"></a></div>
</td>
</tr>
<tr>
<td colspan="3">
<div align="center"><br>
</div>
</td>
</tr>
<tr>
<td valign="top" colspan="3" height="476">
<p align="center"><b><a href="addcar.php">Insert a Caricature!</a></b></p>
<p align="center"><b><a href="addcar.php"><br>
</a>Current Gallery:</b><br>
</p>
<form name="form1" action="">
<div align="center"><br>
<table width="425" border="0" align="center">
<?php while (($Repeat1__numRows-- != 0) && (!$Recordset1->EOF))
{
?>
<tr>
<?php
$theLoop=0;
while (($theLoop <3) && (!$Recordset1->EOF)){
$theLoop++;
?>
<td>
<div align="center">
<table width="250" border="0">
<tr>
<td>
<div align="center"> <b>
<?php echo $Recordset1->Fields("CATEGORY"?>
</b> <br>
<img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"><br>
<?php echo $Recordset1->Fields("INFO"?>
<br>
<input type="button" name="edit" value="Edit" onClick="location.href='edit.php?edit=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'">
<input type="button" name="radiobutton" onClick="location.href='delcar2.php?radiobutton=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'" value="Delete" label="Delete">
<br>
</div>
</td>
</tr>
</table>
</div>
<?php
$Recordset1->MoveNext();
}
?>
</td>
</tr>
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
</table>
<br>
</div>
</form>
</td>
</tr>
<tr>
<td valign="top" colspan="3">
<div align="center">
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center">
<?php if ($MM_offset != 0) { ?>
<a href="<?php echo $MM_moveFirst?>"><img src="First.gif" border=0></a>
<?php } // end $MM_offset != 0 ?>
</td>
<td width="31%" align="center">
<?php if ($MM_offset != 0) { ?>
<a href="<?php echo $MM_movePrev?>"><img src="Previous.gif" border=0></a>
<?php } // end $MM_offset != 0 ?>
</td>
<td width="23%" align="center">
<?php if (!$MM_atTotal) { ?>
<a href="<?php echo $MM_moveNext?>"><img src="Next.gif" border=0></a>
<?php } // end !$MM_atTotal ?>
</td>
<td width="23%" align="center">
<?php if (!$MM_atTotal) { ?>
<a href="<?php echo $MM_moveLast?>"><img src="Last.gif" border=0></a>
<?php } // end !$MM_atTotal ?>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
<?php
$Recordset1->Close();
?>
Keith Slater
Replied 14 Aug 2001 15:04:38
14 Aug 2001 15:04:38 Keith Slater replied:
Does anyone know this answer please...
Keith Slater
Keith Slater
Replied 14 Aug 2001 15:38:17
14 Aug 2001 15:38:17 Tim Green replied:
Keith,
You really should read the UD Documentation. This problem is actually covered in there.
You have created a repeat region, except you haven't limited the options. So, in your situation you would create a repeat region of 12 items. This then allows the Show Region behaviours to work.
If you create a repeat region of all records, and then don't use all of the recordset the excess information is dumped, and the rest of the code doesn't come into play.
BTW: This is called Recordset Navigation, not Live Navigation. Live Navigation implies something else, but this is indeed covered in the UD docs, and there already exists a vast amount of help and documentation on this subject.
I would also recommend that you remove some of your manual editing.
I see you have manually added a session_start() to one of the require blocks. This block has now been duplicated and you run the risk of negating your session_start() command because the same command is issued earlier in the document.
The session_start() command is automatically added when you restrict access to a page.
The other problem I see immediately is with your date creation block :-
<?php
if (isset($myDate)) {
$myDate=$CaricaturePHP->DBDate($myDate);
}
?>
Which is saying if myDate exists set it to the current date.
It should be :-
<?php
if (!isset($myDate)) {
$myDate=$CaricaturePHP->DBDate($myDate);
}
?>
Which allows you to set the date if it isn't already set.
Anyway, I think this should get you moving in the right direction.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
You really should read the UD Documentation. This problem is actually covered in there.
You have created a repeat region, except you haven't limited the options. So, in your situation you would create a repeat region of 12 items. This then allows the Show Region behaviours to work.
If you create a repeat region of all records, and then don't use all of the recordset the excess information is dumped, and the rest of the code doesn't come into play.
BTW: This is called Recordset Navigation, not Live Navigation. Live Navigation implies something else, but this is indeed covered in the UD docs, and there already exists a vast amount of help and documentation on this subject.
I would also recommend that you remove some of your manual editing.
I see you have manually added a session_start() to one of the require blocks. This block has now been duplicated and you run the risk of negating your session_start() command because the same command is issued earlier in the document.
The session_start() command is automatically added when you restrict access to a page.
The other problem I see immediately is with your date creation block :-
<?php
if (isset($myDate)) {
$myDate=$CaricaturePHP->DBDate($myDate);
}
?>
Which is saying if myDate exists set it to the current date.
It should be :-
<?php
if (!isset($myDate)) {
$myDate=$CaricaturePHP->DBDate($myDate);
}
?>
Which allows you to set the date if it isn't already set.
Anyway, I think this should get you moving in the right direction.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 14 Aug 2001 18:12:14
14 Aug 2001 18:12:14 Keith Slater replied:
ok I went a started a brand new page. I have 34 records of pictures that its supposed to load. When I try to do it it loads the first 10 like it should. you hit next and it only shows 4 then you hit next and it shows none. its not filtered or sorted at all. heres the script
<?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
// *** Restrict Access To Page: Grant or deny access to this page
$KT_authorizedUsers=" admin, user";
$KT_authFailedURL="permissions.php";
$KT_grantAccess=0;
session_start();
if (isset($HTTP_SESSION_VARS["KT_Username"])) {
if (false || !(isset($HTTP_SESSION_VARS["KT_UserAuthorization"])) || $HTTP_SESSION_VARS["KT_UserAuthorization"]=="" || strpos($KT_authorizedUsers, $HTTP_SESSION_VARS["KT_UserAuthorization"])) {
$KT_grantAccess = 1;
}
}
if (!$KT_grantAccess) {
$KT_qsChar = "?";
if (strpos($KT_authFailedURL, "?") $KT_qsChar = "&";
$KT_referrer = $PHP_SELF;
if (strlen($QUERY_STRING) > 0) $KT_referrer .= "?" . $QUERY_STRING;
$KT_authFailedURL = $KT_authFailedURL . $KT_qsChar . "accessdenied=" . urlencode($KT_referrer);
header("Location: $KT_authFailedURL"
exit;
}
?><?php
$Recordset1__MMColParam = "1";
if (isset($HTTP_SESSION_VARS["KT_Username"]))
{$Recordset1__MMColParam = $HTTP_SESSION_VARS["KT_Username"];}
?><?php
$Recordset1=$CaricaturePHP->Execute("SELECT * FROM GALLERY_1 WHERE USER_NAME = '" . ($Recordset1__MMColParam) . "' ORDER BY IDNO DESC" or DIE($CaricaturePHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?><?php
$Repeat1__numRows = 8;
$Repeat1__index= 0;
$Recordset1_numRows = $Recordset1_numRows + $Repeat1__numRows;
?><?php
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
$Recordset1_total = $Recordset1->RecordCount();
// set the number of rows displayed on this page
if ($Recordset1_numRows < 0) { // if repeat region set to all records
$Recordset1_numRows = $Recordset1_total;
} else if ($Recordset1_numRows == 0) { // if no repeat regions
$Recordset1_numRows = 1;
}
// set the first and last displayed record
$Recordset1_first = 1;
$Recordset1_last = $Recordset1_first + $Recordset1_numRows - 1;
// if we have the correct record count, check the other stats
if ($Recordset1_total != -1) {
$Recordset1_numRows = min($Recordset1_numRows, $Recordset1_total);
$Recordset1_first = min($Recordset1_first, $Recordset1_total);
$Recordset1_last = min($Recordset1_last, $Recordset1_total);
}
?><?php $MM_paramName = ""; ?><?php
// *** Move To Record and Go To Record: declare variables
$MM_rs = &$Recordset1;
$MM_rsCount = $Recordset1_total;
$MM_size = $Recordset1_numRows;
$MM_uniqueCol = "";
$MM_paramName = "";
$MM_offset = 0;
$MM_atTotal = false;
$MM_paramIsDefined = ($MM_paramName != "" && isset($$MM_paramName));
?><?php
// *** Move To Record: handle 'index' or 'offset' parameter
if (!$MM_paramIsDefined && $MM_rsCount != 0) {
// use index parameter if defined, otherwise use offset parameter
if(isset($index)){
$r = $index;
} else {
if(isset($offset)) {
$r = $offset;
} else {
$r = 0;
}
}
$MM_offset = $r;
// if we have a record count, check if we are past the end of the recordset
if ($MM_rsCount != -1) {
if ($MM_offset >= $MM_rsCount || $MM_offset == -1) { // past end or move last
if (($MM_rsCount % $MM_size) != 0) { // last page not a full repeat region
$MM_offset = $MM_rsCount - ($MM_rsCount % $MM_size);
}
else {
$MM_offset = $MM_rsCount - $MM_size;
}
}
}
// move the cursor to the selected record
for ($i=0;!$MM_rs->EOF && ($i < $MM_offset || $MM_offset == -1); $i++) {
$MM_rs->MoveNext();
}
if ($MM_rs->EOF) $MM_offset = $i; // set MM_offset to the last possible record
}
?><?php
// *** Move To Record: if we dont know the record count, check the display range
if ($MM_rsCount == -1) {
// walk to the end of the display range for this page
for ($i=$MM_offset; !$MM_rs->EOF && ($MM_size < 0 || $i < $MM_offset + $MM_size); $i++) {
$MM_rs->MoveNext();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if ($MM_rs->EOF) {
$MM_rsCount = $i;
if ($MM_size < 0 || $MM_size > $MM_rsCount) $MM_size = $MM_rsCount;
}
// if we walked off the end, set the offset based on page size
if ($MM_rs->EOF && !$MM_paramIsDefined) {
if (($MM_rsCount % $MM_size) != 0) { // last page not a full repeat region
$MM_offset = $MM_rsCount - ($MM_rsCount % $MM_size);
} else {
$MM_offset = $MM_rsCount - $MM_size;
}
}
// reset the cursor to the beginning
$MM_rs->MoveFirst();
// move the cursor to the selected record
for ($i=0; !$MM_rs->EOF && $i < $MM_offset; $i++) {
$MM_rs->MoveNext();
}
}
?><?php
// *** Move To Record: update recordset stats
// set the first and last displayed record
$Recordset1_first = $MM_offset + 1;
$Recordset1_last = $MM_offset + $MM_size;
if ($MM_rsCount != -1) {
$Recordset1_first = $Recordset1_first<$MM_rsCount?$Recordset1_first:$MM_rsCount;
$Recordset1_last = $Recordset1_last<$MM_rsCount?$Recordset1_last:$MM_rsCount;
}
// set the boolean used by hide region to check if we are on the last record
$MM_atTotal = ($MM_rsCount != -1 && $MM_offset + $MM_size >= $MM_rsCount);
?><?php
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
$MM_removeList = "&index=";
if ($MM_paramName != "" $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);
?><?php
// *** Move To Record: set the strings for the first, last, next, and previous links
$MM_moveFirst="";
$MM_moveLast="";
$MM_moveNext="";
$MM_movePrev="";
$MM_keepMove = $MM_keepBoth; // keep both Form and URL parameters for moves
$MM_moveParam = "index";
// if the page has a repeated region, remove 'offset' from the maintained parameters
if ($MM_size > 1) {
$MM_moveParam = "offset";
if (strlen($MM_keepMove)> 0) {
$params = explode("&", $MM_keepMove);
$MM_keepMove = "";
for ($i=0; $i < sizeof($params); $i++) {
list($nextItem) = explode("=", $params[$i]);
if (strtolower($nextItem) != $MM_moveParam) {
$MM_keepMove.="&".$params[$i];
}
}
if (strlen($MM_keepMove) > 0) $MM_keepMove = substr($MM_keepMove, 1);
}
}
// set the strings for the move to links
if (strlen($MM_keepMove) > 0) $MM_keepMove.="&";
$urlStr = $PHP_SELF."?".$MM_keepMove.$MM_moveParam."=";
$MM_moveFirst = $urlStr."0";
$MM_moveLast = $urlStr."-1";
$MM_moveNext = $urlStr.($MM_offset + $MM_size);
$MM_movePrev = $urlStr.(max($MM_offset - $MM_size,0));
?><?php
// *** Logout the current user. false
$KT_Logout = $PHP_SELF . "?KT_Logoutnow=1";
if ($KT_Logoutnow=="1" {
session_start();
session_unregister("KT_Username"
$KT_logoutRedirectPage = "index.php?id=Studio&id2=Convention&id3=Miscellaneous&id4=Published&id5=Celebrity&id6=Showcase";
// redirect with URL parameters (remove the "KT_Logoutnow" query param).
if ($KT_logoutRedirectPage == "" $KT_logoutRedirectPage = $PHP_SELF;
if (!strpos($KT_logoutRedirectPage, "?" && $QUERY_STRING != "" {
$KT_newQS = "?";
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
if($key != "KT_Logoutnow"{
if (strlen($KT_newQS) > 1) $KT_newQS .= "&";
$KT_newQS .= $key . "=" . urlencode($val);
}
}
if (strlen($KT_newQS) > 1) $KT_logoutRedirectPage .= $KT_newQS;
}
header("Location: $KT_logoutRedirectPage"
exit;
}
?>
<html>
<head>
<title>Caricature Forum - Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="740" border="0" align="center">
<tr>
<td height="92" width="139">
<div align="center"><a href="www.wordprosys.com"><img src="WPS1.gif" width="108" height="108" border="0"></a></div>
</td>
<td valign="middle" height="92" width="459">
<div align="center"><br>
<img src="caricathead3%20copy.gif" width="356" height="64"><br>
</div>
<table width="302" border="0" align="center">
<tr>
<td>
<div align="center"><a href="index.php?id=Studio&id2=Convention&id3=Miscellaneous&id4=Published&id5=Celebrity&id6=Showcase">Forum</a>
- <a href="admin.php">Main</a> - <font size="3"><a href="<?php echo $KT_Logout?>">Logout</a></font></div>
</td>
</tr>
</table>
</td>
<td height="92" width="128">
<div align="center"><a href="www.caricature.org"><img src="ncnlogosmall.jpg" width="100" height="72" border="0"></a></div>
</td>
</tr>
<tr>
<td colspan="3">
<div align="center"> <br>
</div>
</td>
</tr>
<tr>
<td valign="top" colspan="3" height="476">
<p align="center"><b><a href="addcar.php">Insert a Caricature!</a></b></p>
<p align="center"><b><a href="addcar.php"><br>
</a>Current Gallery:</b><br>
</p>
<form name="form1" action="">
<div align="center"><br>
<table width="425" border="0" align="center">
<?php while (($Repeat1__numRows-- != 0) && (!$Recordset1->EOF))
{
?>
<tr>
<?php
$theLoop=0;
while (($theLoop <2) && (!$Recordset1->EOF)){
$theLoop++;
?>
<td>
<div align="center">
<table width="250" border="0">
<tr>
<td>
<div align="center"> <b>
<?php echo $Recordset1->Fields("CATEGORY"?>
</b> <br>
<img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"><br>
<?php echo $Recordset1->Fields("INFO"?>
<br>
<input type="button" name="edit" value="Edit" onClick="location.href='edit.php?edit=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'">
<input type="button" name="radiobutton" onClick="location.href='delcar2.php?radiobutton=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'" value="Delete" label="Delete">
<br>
</div>
</td>
</tr>
</table>
</div>
<?php
$Recordset1->MoveNext();
}
?>
</td>
</tr>
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
</table>
<br>
</div>
</form>
</td>
</tr>
<tr>
<td valign="top" colspan="3">
<div align="center">
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center">
<?php if ($MM_offset != 0) { ?>
<a href="<?php echo $MM_moveFirst?>">First</a>
<?php } // end $MM_offset != 0 ?>
</td>
<td width="31%" align="center">
<?php if ($MM_offset != 0) { ?>
<a href="<?php echo $MM_movePrev?>">Previous</a>
<?php } // end $MM_offset != 0 ?>
</td>
<td width="23%" align="center">
<?php if (!$MM_atTotal) { ?>
<a href="<?php echo $MM_moveNext?>">Next</a>
<?php } // end !$MM_atTotal ?>
</td>
<td width="23%" align="center">
<?php if (!$MM_atTotal) { ?>
<a href="<?php echo $MM_moveLast?>">Last</a>
<?php } // end !$MM_atTotal ?>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
<?php
$Recordset1->Close();
?>
thanks again tim
Keith Slater
<?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
// *** Restrict Access To Page: Grant or deny access to this page
$KT_authorizedUsers=" admin, user";
$KT_authFailedURL="permissions.php";
$KT_grantAccess=0;
session_start();
if (isset($HTTP_SESSION_VARS["KT_Username"])) {
if (false || !(isset($HTTP_SESSION_VARS["KT_UserAuthorization"])) || $HTTP_SESSION_VARS["KT_UserAuthorization"]=="" || strpos($KT_authorizedUsers, $HTTP_SESSION_VARS["KT_UserAuthorization"])) {
$KT_grantAccess = 1;
}
}
if (!$KT_grantAccess) {
$KT_qsChar = "?";
if (strpos($KT_authFailedURL, "?") $KT_qsChar = "&";
$KT_referrer = $PHP_SELF;
if (strlen($QUERY_STRING) > 0) $KT_referrer .= "?" . $QUERY_STRING;
$KT_authFailedURL = $KT_authFailedURL . $KT_qsChar . "accessdenied=" . urlencode($KT_referrer);
header("Location: $KT_authFailedURL"
exit;
}
?><?php
$Recordset1__MMColParam = "1";
if (isset($HTTP_SESSION_VARS["KT_Username"]))
{$Recordset1__MMColParam = $HTTP_SESSION_VARS["KT_Username"];}
?><?php
$Recordset1=$CaricaturePHP->Execute("SELECT * FROM GALLERY_1 WHERE USER_NAME = '" . ($Recordset1__MMColParam) . "' ORDER BY IDNO DESC" or DIE($CaricaturePHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?><?php
$Repeat1__numRows = 8;
$Repeat1__index= 0;
$Recordset1_numRows = $Recordset1_numRows + $Repeat1__numRows;
?><?php
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
$Recordset1_total = $Recordset1->RecordCount();
// set the number of rows displayed on this page
if ($Recordset1_numRows < 0) { // if repeat region set to all records
$Recordset1_numRows = $Recordset1_total;
} else if ($Recordset1_numRows == 0) { // if no repeat regions
$Recordset1_numRows = 1;
}
// set the first and last displayed record
$Recordset1_first = 1;
$Recordset1_last = $Recordset1_first + $Recordset1_numRows - 1;
// if we have the correct record count, check the other stats
if ($Recordset1_total != -1) {
$Recordset1_numRows = min($Recordset1_numRows, $Recordset1_total);
$Recordset1_first = min($Recordset1_first, $Recordset1_total);
$Recordset1_last = min($Recordset1_last, $Recordset1_total);
}
?><?php $MM_paramName = ""; ?><?php
// *** Move To Record and Go To Record: declare variables
$MM_rs = &$Recordset1;
$MM_rsCount = $Recordset1_total;
$MM_size = $Recordset1_numRows;
$MM_uniqueCol = "";
$MM_paramName = "";
$MM_offset = 0;
$MM_atTotal = false;
$MM_paramIsDefined = ($MM_paramName != "" && isset($$MM_paramName));
?><?php
// *** Move To Record: handle 'index' or 'offset' parameter
if (!$MM_paramIsDefined && $MM_rsCount != 0) {
// use index parameter if defined, otherwise use offset parameter
if(isset($index)){
$r = $index;
} else {
if(isset($offset)) {
$r = $offset;
} else {
$r = 0;
}
}
$MM_offset = $r;
// if we have a record count, check if we are past the end of the recordset
if ($MM_rsCount != -1) {
if ($MM_offset >= $MM_rsCount || $MM_offset == -1) { // past end or move last
if (($MM_rsCount % $MM_size) != 0) { // last page not a full repeat region
$MM_offset = $MM_rsCount - ($MM_rsCount % $MM_size);
}
else {
$MM_offset = $MM_rsCount - $MM_size;
}
}
}
// move the cursor to the selected record
for ($i=0;!$MM_rs->EOF && ($i < $MM_offset || $MM_offset == -1); $i++) {
$MM_rs->MoveNext();
}
if ($MM_rs->EOF) $MM_offset = $i; // set MM_offset to the last possible record
}
?><?php
// *** Move To Record: if we dont know the record count, check the display range
if ($MM_rsCount == -1) {
// walk to the end of the display range for this page
for ($i=$MM_offset; !$MM_rs->EOF && ($MM_size < 0 || $i < $MM_offset + $MM_size); $i++) {
$MM_rs->MoveNext();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if ($MM_rs->EOF) {
$MM_rsCount = $i;
if ($MM_size < 0 || $MM_size > $MM_rsCount) $MM_size = $MM_rsCount;
}
// if we walked off the end, set the offset based on page size
if ($MM_rs->EOF && !$MM_paramIsDefined) {
if (($MM_rsCount % $MM_size) != 0) { // last page not a full repeat region
$MM_offset = $MM_rsCount - ($MM_rsCount % $MM_size);
} else {
$MM_offset = $MM_rsCount - $MM_size;
}
}
// reset the cursor to the beginning
$MM_rs->MoveFirst();
// move the cursor to the selected record
for ($i=0; !$MM_rs->EOF && $i < $MM_offset; $i++) {
$MM_rs->MoveNext();
}
}
?><?php
// *** Move To Record: update recordset stats
// set the first and last displayed record
$Recordset1_first = $MM_offset + 1;
$Recordset1_last = $MM_offset + $MM_size;
if ($MM_rsCount != -1) {
$Recordset1_first = $Recordset1_first<$MM_rsCount?$Recordset1_first:$MM_rsCount;
$Recordset1_last = $Recordset1_last<$MM_rsCount?$Recordset1_last:$MM_rsCount;
}
// set the boolean used by hide region to check if we are on the last record
$MM_atTotal = ($MM_rsCount != -1 && $MM_offset + $MM_size >= $MM_rsCount);
?><?php
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
$MM_removeList = "&index=";
if ($MM_paramName != "" $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);
?><?php
// *** Move To Record: set the strings for the first, last, next, and previous links
$MM_moveFirst="";
$MM_moveLast="";
$MM_moveNext="";
$MM_movePrev="";
$MM_keepMove = $MM_keepBoth; // keep both Form and URL parameters for moves
$MM_moveParam = "index";
// if the page has a repeated region, remove 'offset' from the maintained parameters
if ($MM_size > 1) {
$MM_moveParam = "offset";
if (strlen($MM_keepMove)> 0) {
$params = explode("&", $MM_keepMove);
$MM_keepMove = "";
for ($i=0; $i < sizeof($params); $i++) {
list($nextItem) = explode("=", $params[$i]);
if (strtolower($nextItem) != $MM_moveParam) {
$MM_keepMove.="&".$params[$i];
}
}
if (strlen($MM_keepMove) > 0) $MM_keepMove = substr($MM_keepMove, 1);
}
}
// set the strings for the move to links
if (strlen($MM_keepMove) > 0) $MM_keepMove.="&";
$urlStr = $PHP_SELF."?".$MM_keepMove.$MM_moveParam."=";
$MM_moveFirst = $urlStr."0";
$MM_moveLast = $urlStr."-1";
$MM_moveNext = $urlStr.($MM_offset + $MM_size);
$MM_movePrev = $urlStr.(max($MM_offset - $MM_size,0));
?><?php
// *** Logout the current user. false
$KT_Logout = $PHP_SELF . "?KT_Logoutnow=1";
if ($KT_Logoutnow=="1" {
session_start();
session_unregister("KT_Username"
$KT_logoutRedirectPage = "index.php?id=Studio&id2=Convention&id3=Miscellaneous&id4=Published&id5=Celebrity&id6=Showcase";
// redirect with URL parameters (remove the "KT_Logoutnow" query param).
if ($KT_logoutRedirectPage == "" $KT_logoutRedirectPage = $PHP_SELF;
if (!strpos($KT_logoutRedirectPage, "?" && $QUERY_STRING != "" {
$KT_newQS = "?";
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
if($key != "KT_Logoutnow"{
if (strlen($KT_newQS) > 1) $KT_newQS .= "&";
$KT_newQS .= $key . "=" . urlencode($val);
}
}
if (strlen($KT_newQS) > 1) $KT_logoutRedirectPage .= $KT_newQS;
}
header("Location: $KT_logoutRedirectPage"
exit;
}
?>
<html>
<head>
<title>Caricature Forum - Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="740" border="0" align="center">
<tr>
<td height="92" width="139">
<div align="center"><a href="www.wordprosys.com"><img src="WPS1.gif" width="108" height="108" border="0"></a></div>
</td>
<td valign="middle" height="92" width="459">
<div align="center"><br>
<img src="caricathead3%20copy.gif" width="356" height="64"><br>
</div>
<table width="302" border="0" align="center">
<tr>
<td>
<div align="center"><a href="index.php?id=Studio&id2=Convention&id3=Miscellaneous&id4=Published&id5=Celebrity&id6=Showcase">Forum</a>
- <a href="admin.php">Main</a> - <font size="3"><a href="<?php echo $KT_Logout?>">Logout</a></font></div>
</td>
</tr>
</table>
</td>
<td height="92" width="128">
<div align="center"><a href="www.caricature.org"><img src="ncnlogosmall.jpg" width="100" height="72" border="0"></a></div>
</td>
</tr>
<tr>
<td colspan="3">
<div align="center"> <br>
</div>
</td>
</tr>
<tr>
<td valign="top" colspan="3" height="476">
<p align="center"><b><a href="addcar.php">Insert a Caricature!</a></b></p>
<p align="center"><b><a href="addcar.php"><br>
</a>Current Gallery:</b><br>
</p>
<form name="form1" action="">
<div align="center"><br>
<table width="425" border="0" align="center">
<?php while (($Repeat1__numRows-- != 0) && (!$Recordset1->EOF))
{
?>
<tr>
<?php
$theLoop=0;
while (($theLoop <2) && (!$Recordset1->EOF)){
$theLoop++;
?>
<td>
<div align="center">
<table width="250" border="0">
<tr>
<td>
<div align="center"> <b>
<?php echo $Recordset1->Fields("CATEGORY"?>
</b> <br>
<img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"><br>
<?php echo $Recordset1->Fields("INFO"?>
<br>
<input type="button" name="edit" value="Edit" onClick="location.href='edit.php?edit=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'">
<input type="button" name="radiobutton" onClick="location.href='delcar2.php?radiobutton=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'" value="Delete" label="Delete">
<br>
</div>
</td>
</tr>
</table>
</div>
<?php
$Recordset1->MoveNext();
}
?>
</td>
</tr>
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
</table>
<br>
</div>
</form>
</td>
</tr>
<tr>
<td valign="top" colspan="3">
<div align="center">
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center">
<?php if ($MM_offset != 0) { ?>
<a href="<?php echo $MM_moveFirst?>">First</a>
<?php } // end $MM_offset != 0 ?>
</td>
<td width="31%" align="center">
<?php if ($MM_offset != 0) { ?>
<a href="<?php echo $MM_movePrev?>">Previous</a>
<?php } // end $MM_offset != 0 ?>
</td>
<td width="23%" align="center">
<?php if (!$MM_atTotal) { ?>
<a href="<?php echo $MM_moveNext?>">Next</a>
<?php } // end !$MM_atTotal ?>
</td>
<td width="23%" align="center">
<?php if (!$MM_atTotal) { ?>
<a href="<?php echo $MM_moveLast?>">Last</a>
<?php } // end !$MM_atTotal ?>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
<?php
$Recordset1->Close();
?>
thanks again tim
Keith Slater
Replied 14 Aug 2001 19:36:13
14 Aug 2001 19:36:13 Keith Slater replied:
ok I got the navigation stuff figured out it just doesnt load all my pictures for some reason still. its the same script as above
thanks
Keith Slater
thanks
Keith Slater
Replied 14 Aug 2001 20:43:56
14 Aug 2001 20:43:56 Tim Green replied:
If it doesn't load all your pictures, even though you define a path, and use the result of a column as the filename, then you are going to have to check that every filename is correct, that the path is correct, and that the case of each filename is correct.
Please do not post any more code listings to this thread, which is already impossible to read.
It is likely that if problems persist, that it has something to do with the script that recurs across the page. It is for this reason that the Horizontal Looper was created.
I would suggest that if you still have problems that you strip the code back down to basics, then apply the standard repeat region alone, and see what kind of result you get, and then build on that.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Please do not post any more code listings to this thread, which is already impossible to read.
It is likely that if problems persist, that it has something to do with the script that recurs across the page. It is for this reason that the Horizontal Looper was created.
I would suggest that if you still have problems that you strip the code back down to basics, then apply the standard repeat region alone, and see what kind of result you get, and then build on that.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 14 Aug 2001 23:39:23
14 Aug 2001 23:39:23 Keith Slater replied:
ok sorry about the posts. I figured out what my script is doing. I have 34 pictures. The repeat region shows 10 on a page. I found out that it only shows 14. 20 less than what it should. So I printed out all the pictures that it should show. And I circled the pictures that it shows. I realized that it skips my first 10 pictures. Then shows the next 10 pictures on the page. Then I saw it skipped the next 10 pictures and displays teh next 4 on the next page. So for some reason it wants to skip 10 pictures on each page that is displayed. Its kinda weird. Do you have any ideas of why this might be happening tim??
thanks again
Keith Slater
thanks again
Keith Slater
Replied 15 Aug 2001 01:18:25
15 Aug 2001 01:18:25 Tim Green replied:
Keith, I don't mind about the posts at all ! I was just a little concerned about the length of some of the code.
Anyway, I've hacked around a bit of Tom Muck's Horizontal Looper code, and this works fine for me, hopefully it should work for you too :-
<form name="form1" action="">
<div align="center"><br>
<table width="425" border="0" align="center">
<?php
$startrw=0;
$endrw=$Repeat1__index;
$numberColumns=2;
$numrows=ceil($Repeat1__numRows/$numberColumns);
while(($numrows-- !=0) && (!$Recordset1->EOF)) {
$startrw=$endrw + 1;
$endrw = $endrw + $numberColumns;
?>
<tr>
<?php while (($startrw <= $endrw) && (!$Recordset1->EOF)) { ?>
<td>
<div align="center">
<table width="250" border="0">
<tr>
<td>
<div align="center"> <b>
<?php echo $Recordset1->Fields("CATEGORY"?>
</b> <br>
<img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"><br>
<?php echo $Recordset1->Fields("INFO"?>
<br>
<input type="button" name="edit" value="Edit" onClick="location.href='edit.php?edit=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'">
<input type="button" name="radiobutton" onClick="location.href='delcar2.php?radiobutton=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'" value="Delete" label="Delete">
<br>
</div>
</td>
</tr>
</table>
</div>
<?php
$startrw++;
$Recordset1->MoveNext();
}
?>
</td>
</tr>
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
</table>
<br>
</div>
</form>
I've just replaced the looper code I gave you earlier for something a little more robust.
Hope this helps
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Anyway, I've hacked around a bit of Tom Muck's Horizontal Looper code, and this works fine for me, hopefully it should work for you too :-
<form name="form1" action="">
<div align="center"><br>
<table width="425" border="0" align="center">
<?php
$startrw=0;
$endrw=$Repeat1__index;
$numberColumns=2;
$numrows=ceil($Repeat1__numRows/$numberColumns);
while(($numrows-- !=0) && (!$Recordset1->EOF)) {
$startrw=$endrw + 1;
$endrw = $endrw + $numberColumns;
?>
<tr>
<?php while (($startrw <= $endrw) && (!$Recordset1->EOF)) { ?>
<td>
<div align="center">
<table width="250" border="0">
<tr>
<td>
<div align="center"> <b>
<?php echo $Recordset1->Fields("CATEGORY"?>
</b> <br>
<img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"><br>
<?php echo $Recordset1->Fields("INFO"?>
<br>
<input type="button" name="edit" value="Edit" onClick="location.href='edit.php?edit=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'">
<input type="button" name="radiobutton" onClick="location.href='delcar2.php?radiobutton=<?php echo $Recordset1->Fields("PICTURE_NAME"?>'" value="Delete" label="Delete">
<br>
</div>
</td>
</tr>
</table>
</div>
<?php
$startrw++;
$Recordset1->MoveNext();
}
?>
</td>
</tr>
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
</table>
<br>
</div>
</form>
I've just replaced the looper code I gave you earlier for something a little more robust.
Hope this helps
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 15 Aug 2001 15:11:57
15 Aug 2001 15:11:57 Keith Slater replied:
Hey that script works and its cool. But as soon as I add recordset navigation to it it does the skipping 10 thing just as above. Theirs gotta be something Im missing here. Phakt keeps on putting something in my script and I cant find it.
Keith Slater
Keith Slater
Replied 15 Aug 2001 16:58:34
15 Aug 2001 16:58:34 Tim Green replied:
That's because the recordset navigation is breaking the code you just entered.
Try inserting the navigation, and then adding the fixed code I sent to you. It should work just fine (it did for me).
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Try inserting the navigation, and then adding the fixed code I sent to you. It should work just fine (it did for me).
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>