Forums
This topic is locked
navigation problems again
Posted 09 Apr 2002 13:18:11
1
has voted
09 Apr 2002 13:18:11 Toomas Riim posted:
I'm still stuck with navigating on my pages. On the main page I have a table with the data taken dynamically from the database. There are columns called "ID", "Name", "Price". The "Name" column has Go To Detail page server behavior in order to display more info about any single record with particular name on a detail page. On a detail page I have the same recordset as on the main page, but I have filtered out the GoToDetail page column, which enables me to view one particular item on the detail page. But now I also want to put next/prev links to this detail page in order to display the next or previous item one by one. But I'm not able to that. Is it possible to do at all? Can anyone help me?Replies
Replied 09 Apr 2002 20:16:02
09 Apr 2002 20:16:02 Matthijs Horsman replied:
Hi Toomas,
Doesn't sound like a big problem, just apply the move to next or previous record from the Server Bahaviour panel and normally your set!
ps you can do the same on the main page with the list, just make a repeat region of say 10 and apply the move to next record server behaviour and your done. Or you choose
Insert -> Live Objects -> Recordset Navigation bar and then UD does evrything for you <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Let me know if it doesn't work out
Grrrr
Matthijs
----------------
Doesn't sound like a big problem, just apply the move to next or previous record from the Server Bahaviour panel and normally your set!
ps you can do the same on the main page with the list, just make a repeat region of say 10 and apply the move to next record server behaviour and your done. Or you choose
Insert -> Live Objects -> Recordset Navigation bar and then UD does evrything for you <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Let me know if it doesn't work out
Grrrr
Matthijs
----------------
Replied 10 Apr 2002 16:30:56
10 Apr 2002 16:30:56 Toomas Riim replied:
Thanks, but let me clarify again the problem. On the detail page I want to display an item linked from the master page. But instead of browsing back from the detail page to the master page and of clicking again a link to the next item, I want to have on the detail page next or previous links to the next item indicated on the master page. Any ideas how to do that?
Replied 10 Apr 2002 19:52:49
10 Apr 2002 19:52:49 Matthijs Horsman replied:
Ok, i will try to be a little more specific!!
<b>Master page:</b>
Displays records out of database repeated with the repeat region.
With the go to detail page SB you go to the detail page.
All clear so far
<b>Detail page:</b>
Create the same recordset as in the master page
apply the move to specific record record behaviour
apply the move to next record (DW will ask you ta creat a link)
do the same with the move to prevoius record.
That's it your done!
Hope this helps
Grrrr
Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
<b>Master page:</b>
Displays records out of database repeated with the repeat region.
With the go to detail page SB you go to the detail page.
All clear so far
<b>Detail page:</b>
Create the same recordset as in the master page
apply the move to specific record record behaviour
apply the move to next record (DW will ask you ta creat a link)
do the same with the move to prevoius record.
That's it your done!
Hope this helps
Grrrr
Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
Replied 11 Apr 2002 11:16:02
11 Apr 2002 11:16:02 Toomas Riim replied:
It doesn't solve the problem. If I put "move to next record", it goes to the FIRST record not to the NEXT record. The same happens with "move to previous record". It seems to understand right that there is only one record on the detail page. But how to build next/prev links on the detail page in order to give a viewer the possibility to navigate next and previous records on the same detail page, without browsing back to the master page?
Replied 11 Apr 2002 15:56:47
11 Apr 2002 15:56:47 Matthijs Horsman replied:
Hi Toomas,
Maybe you got the thing online somewhere (or can put it online) so i can view it.
Otherwise send me an email with the IP adres so i can look at it on your IIS.
Because it's very strange that it moves to the next record....
Grrrr
Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
Maybe you got the thing online somewhere (or can put it online) so i can view it.
Otherwise send me an email with the IP adres so i can look at it on your IIS.
Because it's very strange that it moves to the next record....
Grrrr
Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
Replied 11 Apr 2002 16:56:10
11 Apr 2002 16:56:10 Toomas Riim replied:
I can't put it online until I solve the problem. I dont have an IP, because of dialup modem. By the way, I'm using PHP extension (Phakt) to the UD. Otherwise it works very well, but this navigation problematique is puzzling for me...
Replied 12 Apr 2002 19:18:23
12 Apr 2002 19:18:23 Toomas Riim replied:
Maybe it easier to understand the problem if I put some code here.
<b>Master page code is like follows:</b>
<pre id=code><font face=courier size=2 id=code><?php
$rosetid=$connvirt372->Execute("SELECT * FROM rosetid" or DIE($connvirt372->ErrorMsg());
$rosetid_numRows=0;
$rosetid__totalRows=$rosetid->RecordCount();
?><?php
$Repeat1__numRows = -1;
$Repeat1__index= 0;
$rosetid_numRows = $rosetid_numRows + $Repeat1__numRows;
?><?php $MM_paramName = ""; ?><?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
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
$rosetid_total = $rosetid->RecordCount();
// set the number of rows displayed on this page
if ($rosetid_numRows < 0) { // if repeat region set to all records
$rosetid_numRows = $rosetid_total;
} else if ($rosetid_numRows == 0) { // if no repeat regions
$rosetid_numRows = 1;
}
// set the first and last displayed record
$rosetid_first = 1;
$rosetid_last = $rosetid_first + $rosetid_numRows - 1;
// if we have the correct record count, check the other stats
if ($rosetid_total != -1) {
$rosetid_numRows = min($rosetid_numRows, $rosetid_total);
$rosetid_first = min($rosetid_first, $rosetid_total);
$rosetid_last = min($rosetid_last, $rosetid_total);
}
?><?php
// *** Move To Record and Go To Record: declare variables
$MM_rs = &$rosetid;
$MM_rsCount = $rosetid_total;
$MM_size = $rosetid_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
$rosetid_first = $MM_offset + 1;
$rosetid_last = $MM_offset + $MM_size;
if ($MM_rsCount != -1) {
$rosetid_first = $rosetid_first<$MM_rsCount?$rosetid_first:$MM_rsCount;
$rosetid_last = $rosetid_last<$MM_rsCount?$rosetid_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
// *** 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 while (($Repeat1__numRows-- != 0) && (!$rosetid->EOF))
{
?>
<tr>
<td width="2%">
<p align="center">
<?php echo $rosetid->Fields("nr"?>
</p>
</td>
<td width="7%">
<p align="center"> <A name="#<?php echo $rosetid->Fields("nr"?>" HREF="rosetidetailid.php?<?php echo $MM_keepBoth.(($MM_keepBoth!=""?"&":""."nr=".$rosetid->Fields("nr" ?>">
<?php echo $rosetid->Fields("name"?>
</A> </p>
</td>
<td width="12%">
<p align="center">
<?php echo $rosetid->Fields("pindala"?>
<font color="#CCCCCC">. </font></p>
</td>
<td width="15%">
<p align="center">
<?php echo $rosetid->Fields("hind"?>
<font color="#FFFFFF">. </font></p>
</td>
</tr>
<?php
$Repeat1__index++;
$rosetid->MoveNext();
}
?> </font id=code></pre id=code>
<b>And the detail page code: (how to put next/prev links here?)</b>
<pre id=code><font face=courier size=2 id=code>?php
$rosetid__MMColParam = "1";
if (isset($HTTP_GET_VARS["nr"]))
{$rosetid__MMColParam = $HTTP_GET_VARS["nr"];}
?><?php
$rosetid=$connvirt372->Execute("SELECT * FROM rosetid WHERE nr = '" . ($rosetid__MMColParam) . "'" or DIE($connvirt372->ErrorMsg());
$rosetid_numRows=0;
$rosetid__totalRows=$rosetid->RecordCount();
?><?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
// *** 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
// *** Recordset Stats: if we don't know the record count, manually count them
// set the number of rows displayed on this page
if ($rosetid_numRows < 0 || $rosetid_numRows > $rosetid_total) {
$rosetid_numRows = $rosetid_total;
}
// set the first and last displayed record
$rosetid_last = min($rosetid_first + $rosetid_numRows - 1, $rosetid_total);
$rosetid_first = min($rosetid_first, $rosetid_total);
?>
</font id=code></pre id=code>
<b>Master page code is like follows:</b>
<pre id=code><font face=courier size=2 id=code><?php
$rosetid=$connvirt372->Execute("SELECT * FROM rosetid" or DIE($connvirt372->ErrorMsg());
$rosetid_numRows=0;
$rosetid__totalRows=$rosetid->RecordCount();
?><?php
$Repeat1__numRows = -1;
$Repeat1__index= 0;
$rosetid_numRows = $rosetid_numRows + $Repeat1__numRows;
?><?php $MM_paramName = ""; ?><?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
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
$rosetid_total = $rosetid->RecordCount();
// set the number of rows displayed on this page
if ($rosetid_numRows < 0) { // if repeat region set to all records
$rosetid_numRows = $rosetid_total;
} else if ($rosetid_numRows == 0) { // if no repeat regions
$rosetid_numRows = 1;
}
// set the first and last displayed record
$rosetid_first = 1;
$rosetid_last = $rosetid_first + $rosetid_numRows - 1;
// if we have the correct record count, check the other stats
if ($rosetid_total != -1) {
$rosetid_numRows = min($rosetid_numRows, $rosetid_total);
$rosetid_first = min($rosetid_first, $rosetid_total);
$rosetid_last = min($rosetid_last, $rosetid_total);
}
?><?php
// *** Move To Record and Go To Record: declare variables
$MM_rs = &$rosetid;
$MM_rsCount = $rosetid_total;
$MM_size = $rosetid_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
$rosetid_first = $MM_offset + 1;
$rosetid_last = $MM_offset + $MM_size;
if ($MM_rsCount != -1) {
$rosetid_first = $rosetid_first<$MM_rsCount?$rosetid_first:$MM_rsCount;
$rosetid_last = $rosetid_last<$MM_rsCount?$rosetid_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
// *** 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 while (($Repeat1__numRows-- != 0) && (!$rosetid->EOF))
{
?>
<tr>
<td width="2%">
<p align="center">
<?php echo $rosetid->Fields("nr"?>
</p>
</td>
<td width="7%">
<p align="center"> <A name="#<?php echo $rosetid->Fields("nr"?>" HREF="rosetidetailid.php?<?php echo $MM_keepBoth.(($MM_keepBoth!=""?"&":""."nr=".$rosetid->Fields("nr" ?>">
<?php echo $rosetid->Fields("name"?>
</A> </p>
</td>
<td width="12%">
<p align="center">
<?php echo $rosetid->Fields("pindala"?>
<font color="#CCCCCC">. </font></p>
</td>
<td width="15%">
<p align="center">
<?php echo $rosetid->Fields("hind"?>
<font color="#FFFFFF">. </font></p>
</td>
</tr>
<?php
$Repeat1__index++;
$rosetid->MoveNext();
}
?> </font id=code></pre id=code>
<b>And the detail page code: (how to put next/prev links here?)</b>
<pre id=code><font face=courier size=2 id=code>?php
$rosetid__MMColParam = "1";
if (isset($HTTP_GET_VARS["nr"]))
{$rosetid__MMColParam = $HTTP_GET_VARS["nr"];}
?><?php
$rosetid=$connvirt372->Execute("SELECT * FROM rosetid WHERE nr = '" . ($rosetid__MMColParam) . "'" or DIE($connvirt372->ErrorMsg());
$rosetid_numRows=0;
$rosetid__totalRows=$rosetid->RecordCount();
?><?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
// *** 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
// *** Recordset Stats: if we don't know the record count, manually count them
// set the number of rows displayed on this page
if ($rosetid_numRows < 0 || $rosetid_numRows > $rosetid_total) {
$rosetid_numRows = $rosetid_total;
}
// set the first and last displayed record
$rosetid_last = min($rosetid_first + $rosetid_numRows - 1, $rosetid_total);
$rosetid_first = min($rosetid_first, $rosetid_total);
?>
</font id=code></pre id=code>
Replied 13 Apr 2002 01:28:37
13 Apr 2002 01:28:37 Matthijs Horsman replied:
whoops! your are using PHP!
Sorry... am using ASP/VB SCRIPT don't really know much of this ..
Grrrr
Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
Sorry... am using ASP/VB SCRIPT don't really know much of this ..
Grrrr
Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
Replied 13 Apr 2002 11:40:16
13 Apr 2002 11:40:16 Toomas Riim replied:
It's basically the same. Building recordsets and links are similar.
Replied 13 Apr 2002 16:08:28
13 Apr 2002 16:08:28 Tabe Ydo replied:
Well if it's the same, maybe i can send you the whole thing in ASP/VB script so you can see how that works...