Forums
This topic is locked
Horizontal Looping Again
Posted 27 Aug 2001 15:45:58
1
has voted
27 Aug 2001 15:45:58 Keith Slater posted:
I still can not get this to work at all, I've tried different scripts, everything I can not get this to work for the life of me. I always have different problems. On one of my scripts it skips every 3rd image it should display on different scripts it doesnt even make it horizontal. Could some one send me a sample script that they have that they know works please?? Thanks for all your helpKeith
Keith Slater
Replies
Replied 27 Aug 2001 18:57:13
27 Aug 2001 18:57:13 Bruno Mairlot replied:
Hi Keith,
Here is a skeleton that will show you how to loop horizontally AND vertically.
<pre id=code><font face=courier size=2 id=code>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font color=red>
<table width="100" border="0">
<?php
for($i=0;$i<15;$i++){
?>
<?php
if(($i%5)==0){
?>
<tr>
<?php
}
?>
<td><?php echo $i?></td>
<?php
if(($i%5)==4){
?>
</tr>
<?php
}
?>
<?php
}
?>
</font id=red>
</table>
</body>
</html>
</font id=code></pre id=code>
I have tested it, and it works.
Don't forget to replace the 5 to the number of horizontal column you want to have (3 for example), and replace the 4 by this number-1 (2 for example).
Try this, and if doesn't work for you, then please post the HTML output.
Bruno
"First they laugh at you, then they fight you, then you Win..." Ghandi
Here is a skeleton that will show you how to loop horizontally AND vertically.
<pre id=code><font face=courier size=2 id=code>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font color=red>
<table width="100" border="0">
<?php
for($i=0;$i<15;$i++){
?>
<?php
if(($i%5)==0){
?>
<tr>
<?php
}
?>
<td><?php echo $i?></td>
<?php
if(($i%5)==4){
?>
</tr>
<?php
}
?>
<?php
}
?>
</font id=red>
</table>
</body>
</html>
</font id=code></pre id=code>
I have tested it, and it works.
Don't forget to replace the 5 to the number of horizontal column you want to have (3 for example), and replace the 4 by this number-1 (2 for example).
Try this, and if doesn't work for you, then please post the HTML output.
Bruno
"First they laugh at you, then they fight you, then you Win..." Ghandi
Replied 27 Aug 2001 19:41:22
27 Aug 2001 19:41:22 Keith Slater replied:
Hey cool it displayed the right amount of images that it was supposed to the onyl thing ia it displays the same image... heres the code I have
<?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?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
$Recordset1=$CaricaturePHP->Execute("SELECT * FROM GALLERY_1 WHERE USER_NAME = '" . ($Recordset1__MMColParam) . "'" or DIE($CaricaturePHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?>
<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="600" border="0" cellspacing="0" cellpadding="0" align="center">
<?php
for($i=0;$i<15;$i++){
?>
<?php
if(($i%2)==0){
?>
<tr>
<?php
}
?>
<td>
<div align="center">
<p><img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"></p>
<p> </p>
</div>
</td>
<?php
if(($i%2)==2){
?>
</tr>
<tr>
<td height="5"> </td>
</tr>
<?php
}
?>
<?php
}
?>
</table>
</body>
</html>
<?php
$Recordset1->Close();
?>
it needs some kind of movenext or something
thanks a lot
Keith Slater
<?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?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
$Recordset1=$CaricaturePHP->Execute("SELECT * FROM GALLERY_1 WHERE USER_NAME = '" . ($Recordset1__MMColParam) . "'" or DIE($CaricaturePHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?>
<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="600" border="0" cellspacing="0" cellpadding="0" align="center">
<?php
for($i=0;$i<15;$i++){
?>
<?php
if(($i%2)==0){
?>
<tr>
<?php
}
?>
<td>
<div align="center">
<p><img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"></p>
<p> </p>
</div>
</td>
<?php
if(($i%2)==2){
?>
</tr>
<tr>
<td height="5"> </td>
</tr>
<?php
}
?>
<?php
}
?>
</table>
</body>
</html>
<?php
$Recordset1->Close();
?>
it needs some kind of movenext or something
thanks a lot
Keith Slater
Replied 27 Aug 2001 19:47:24
27 Aug 2001 19:47:24 Keith Slater replied:
wait a sec I was looking at the script and it places 15 no matter what... I want it to place it by how many their are by their user name so if their 13 of the user I want to shwo the 13 pictures....
thanks
Keith Slater
thanks
Keith Slater
Replied 27 Aug 2001 20:53:11
27 Aug 2001 20:53:11 Bruno Mairlot replied:
Keith,
I've changed the code to make it work correctly...
<pre id=code><font face=courier size=2 id=code>
<?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?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
$Recordset1=$CaricaturePHP->Execute("SELECT * FROM GALLERY_1 WHERE USER_NAME = '" . ($Recordset1__MMColParam) . "'" or DIE($CaricaturePHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; ch****t=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<?php
while (($Repeat1__numRows-- != 0) && (!$Recordset1->EOF))
?>
<?php
if(($Repeat1__index%2)==0){
?>
<tr>
<?php
}
?>
<td>
<div align="center">
<p><img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"></p>
<p> </p>
</div>
</td>
<?php
if(($Repeat1__index%2)==2){
?>
</tr>
<tr>
<td height="5"> </td>
</tr>
<?php
}
?>
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
</table>
</body>
</html>
<?php
$Recordset1->Close();
?>
</font id=code></pre id=code>
"First they laugh at you, then they fight you, then you Win..." Ghandi
I've changed the code to make it work correctly...
<pre id=code><font face=courier size=2 id=code>
<?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?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
$Recordset1=$CaricaturePHP->Execute("SELECT * FROM GALLERY_1 WHERE USER_NAME = '" . ($Recordset1__MMColParam) . "'" or DIE($CaricaturePHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; ch****t=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<?php
while (($Repeat1__numRows-- != 0) && (!$Recordset1->EOF))
?>
<?php
if(($Repeat1__index%2)==0){
?>
<tr>
<?php
}
?>
<td>
<div align="center">
<p><img src="images/<?php echo $Recordset1->Fields("PICTURE_NAME"?>" width="150" height="150"></p>
<p> </p>
</div>
</td>
<?php
if(($Repeat1__index%2)==2){
?>
</tr>
<tr>
<td height="5"> </td>
</tr>
<?php
}
?>
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
</table>
</body>
</html>
<?php
$Recordset1->Close();
?>
</font id=code></pre id=code>
"First they laugh at you, then they fight you, then you Win..." Ghandi
Replied 27 Aug 2001 21:21:51
27 Aug 2001 21:21:51 Keith Slater replied:
Hmm not im getting a parse error on line 61 which is:
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
I copied your script exact too
thank you!!
Keith Slater
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
I copied your script exact too
thank you!!
Keith Slater
Replied 27 Aug 2001 23:28:05
27 Aug 2001 23:28:05 Bruno Mairlot replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hmm not im getting a parse error on line 61 which is:
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
I copied your script exact too
thank you!!
Keith Slater
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Yes you're right...I forget to include the first { just after the while !! (near line 30)
change the line with the while with :
while (($Repeat1__numRows-- != 0) && (!$Recordset1->EOF)) <font color=red><b>{</b></font id=red>
And it should be fine.
"First they laugh at you, then they fight you, then you Win..." Ghandi
Hmm not im getting a parse error on line 61 which is:
<?php
$Repeat1__index++;
$Recordset1->MoveNext();
}
?>
I copied your script exact too
thank you!!
Keith Slater
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Yes you're right...I forget to include the first { just after the while !! (near line 30)
change the line with the while with :
while (($Repeat1__numRows-- != 0) && (!$Recordset1->EOF)) <font color=red><b>{</b></font id=red>
And it should be fine.
"First they laugh at you, then they fight you, then you Win..." Ghandi
Replied 28 Aug 2001 15:04:27
28 Aug 2001 15:04:27 Keith Slater replied:
I changed it now when I try it I get no images to display at all...
thanks
keith
Keith Slater
thanks
keith
Keith Slater
Replied 28 Aug 2001 20:52:10
28 Aug 2001 20:52:10 Keith Slater replied:
Hey thanks I got it to work now.... with the script you gave me!! Now Im trying to add navigation to it (next and previous) and its doing weird stuff. Its skipping the first 10 then display 10 on the page. Then you hit next, it skips 10 and displays the next 10, its weird, do you know what might be causing that?
Keith Slater
Keith Slater
Replied 31 Aug 2001 15:00:30
31 Aug 2001 15:00:30 Keith Slater replied:
bump
Keith Slater
Keith Slater
Replied 01 Sep 2001 16:14:07
01 Sep 2001 16:14:07 Tim Green replied:
Keith, the problem you are finding with the navigation is because you are using the standard navigation suite in a situation where you are using a customised repeat region.
In this instance you will also need to use a customized navigation suite, which you will have to write from scratch.
Please remember, that whenever you stray from the path of the inbuilt behaviours with UD, that you will also have to do the same for any behaviours relating to it.
The recordset is fine as you are using the standard recordset system, though anything relating to repeat regions, and region navigation will have to be hand-coded from hereon in when dealing with this specific page.
I would also like to remind you that this is now a new question, and therefore it requires a new thread. This thread may be related, but navigation issues should be dealt with separately.
Thanks
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>
In this instance you will also need to use a customized navigation suite, which you will have to write from scratch.
Please remember, that whenever you stray from the path of the inbuilt behaviours with UD, that you will also have to do the same for any behaviours relating to it.
The recordset is fine as you are using the standard recordset system, though anything relating to repeat regions, and region navigation will have to be hand-coded from hereon in when dealing with this specific page.
I would also like to remind you that this is now a new question, and therefore it requires a new thread. This thread may be related, but navigation issues should be dealt with separately.
Thanks
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>