PDA

View Full Version : Repeat Region - Row Color Interchange


alamask
04-20-2007, 09:39 PM
I have a quick question. How do you interchange the color between each row in a repeat region?
:mrgreen:

davidj
04-21-2007, 08:43 AM
what you using asp or php

davidj
04-21-2007, 09:58 AM
post your code

alamask
04-21-2007, 02:44 PM
im using asp

domedia
04-21-2007, 02:51 PM
Isn't there a 'repeat region' already in DW? Highlight the first row and choose alternate row colors?

alamask
04-21-2007, 04:52 PM
not with the basic 'repeat region' behavior..there is no option for changing row color unless u used some extension.

davidj
04-21-2007, 04:52 PM
post your code

do you understand asp

alamask
04-21-2007, 05:12 PM
im learning and writing asp code at the same time, but not too bad at it...the code is at work so..cant post it now. I'll mon when i go to work.
i was just wondering if there was a function built in dreamweaver that i dont know, but i'll post my code MOn

davidj
04-21-2007, 05:17 PM
i have just wrote a function that will do it in PHP

its Ingenious

infact i was quite impressed with myself i even cracked a smile

alamask
04-23-2007, 04:57 PM
<%
While ((Repeat1__numRows <> 0) AND (NOT rsLateLoads.EOF))
%>
<tr >
'here are just all the table need to be repeated
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsLateLoads.MoveNext()
Wend
%>

davidj
04-23-2007, 05:08 PM
damn

you had to use ASP

i had devised a cunning function and it was ingenious but only in PHP

alamask
04-23-2007, 05:19 PM
can I see it? i might get the idea outta it..who knows it could be helpful haha
by the way..i dont know why we are doing it in asp either, asp+mysql, i guess php would be a better choice.

davidj
04-23-2007, 05:41 PM
if its not too late to change over it would be allot easier and i would be at hand to guide you

davidj
04-23-2007, 06:00 PM
ok

in PHP you have a loop


<table>

<?php

$no = 1; //<< set start counter

do { //<< start loop

$divide = $no / 2; //<< divide by 2 which will turn odd numbers into floats

//<< set boolean $detect using string search.
//Search for decimal in float.
//If found you have detected odd numeric.
$detect = strstr($divide,'.');

?>

//check the IF statement in <tr> to echo the appropriate class
//if $detect is true then that is odd so echo color1 else echo color2

<tr <?php if($detect){echo "class=\"color1\"";}else{echo "class=\"color2\"";} ?>>
<td><?php echo $row['field1_id'];?>

<td><?php echo $row['field2'];?>

<td><?php echo $row['field3'];?>

<td><?php echo $row['field4'];?>
</tr>

<?php

$no++; //<< increment count.

}while ($row = mysql_fetch_array($result))

?>

<table>


this is ingenious if i say so myself...