PDA

View Full Version : results loop across different divs in a sucasa template


phil.evans372967
05-23-2009, 02:13 PM
Hi all

I'm trying to get dataassist results to display using a do loop across 3 different divs in a row across 2 rows

My sql looks like this

SELECT *
FROM prop_details
WHERE featured = 1
ORDER BY add_date DESC LIMIT 0,6

My three different divs look like this

<div class="homeleft-box"> <span class="homefeaturetitle">Town Name</span><img src="../images/sample1.jpg" width="79" height="78" />
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris non sem id purus iaculis suscipit. </p>
<p>Donec rhoncus faucibus odio. <a href="#">Read more...</a></p>
</div>
<div class="homemiddle-box"><span class="homefeaturetitle">Town Name</span><img src="../images/sample2.jpg" width="79" height="78" />
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris non sem id purus iaculis suscipit. </p>
<p>Donec rhoncus faucibus odio. <a href="#">Read more...</a></p>
</div>
<div class="homeright-box"><span class="homefeaturetitle">Town Name</span><img src="../images/sample3.jpg" width="79" height="78" />
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris non sem id purus iaculis suscipit. </p>
<p>Donec rhoncus faucibus odio. <a href="#"> Read more...</a></p>
</div>

How can I get the 6 results to display in a different div?

Thanks

Phil

Ray Borduin
05-26-2009, 09:15 AM
I would probably do it all as one div and use the iterator class disucssed on: http://www.webassist.com/forums/showthread.php?t=1136

It would end up looking like:

<div class="<?php echo $WARRT_AltClass1->getClass(true); ?>"> <span class="homefeaturetitle">Town Name</span><img src="../images/sample1.jpg" width="79" height="78" />
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris non sem id purus iaculis suscipit. </p>
<p>Donec rhoncus faucibus odio. <a href="#">Read more...</a></p>
</div>

Then you could repeat it for 6 records using the DW repeat region server behavior.

Then you could use the repeat selection server behavior that comes with dataAssist to repeat subcontent across three rows if you want a separate div surrounding each three row set, but you may not need that if you just want one encapsulating div for all six rows... in that case the standard DW repeat region and the WA Iterator class will do the trick.

phil.evans372967
05-26-2009, 12:38 PM
Thanks Ray. That works perfectly

Cheers

Phil