Sunday, December 30, 2012

Re: CAKEPHP 2.1.x on Pagodabox | foreach multiple items for each slide (bootstrap carousel)

die(debug($ads));

Are you certain of the array structure?

On Sat, Dec 29, 2012 at 5:39 PM, SvenP <sven@dskbvba.be> wrote:
> Hi,
>
> I'm looking for a way to show multiple 'Ads' / slide with a foreach loop
> from the db. ( each client has ads tied to them.)
>
> My code now works great but only shows one ad / slide.
>
> Thanks for your time!
>
> Sven
>
> Code:
> ___________
>
> <div class="carousel-inner">
> <?php foreach ($ads as $indexValue => $ad):
> if($indexValue == 0){?>
> <div class="item active">
> <a class="adshref" href="//<?php echo $ad['Ad']['link']?>"><?php echo
> $ad['Ad']['title']?></a><br>
> <span class="adslink"><?php echo $ad['Ad']['link']?></span><br>
> <span class="adsbody"><?php echo $ad['Ad']['body']?></span><br></div><?php
> } else { ?>
> <div class="item">
> <a class="adshref" href="//<?php echo $ad['Ad']['link']?>"><?php echo
> $ad['Ad']['title']?></a><br>
> <span class="adslink"><?php echo $ad['Ad']['link']?></span><br>
> <span class="adsbody"><?php echo $ad['Ad']['body']?></span><br></div>
> <?php } endforeach; ?> </div>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: