My PHP isnt to great i am trying to build a small module for joomla, at the moment i have this code:
<?php $a = array(1, 2, 3, 4); ?>
<div class="bannercontainer">
<ul>
<?php foreach($a as $v): ?>
<li data-transition="fade" data-startalign="left,bottom" data-zoom="in" data-zoomfact="5" data-endalign="center,top" data-panduration="12" data-colortransition="4">
<img alt="" src="images/slides/image1.jpg" data-thumb="images/thumbs/thumb1.jpg">
<div class="creative_layer">
<div class="clear"></div>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
which basically foreach number in the array generates a list item awith image etc for the slider.. but how would i associate other things with it, so that it generates but also depending on the settings in the xml file it also for example alters <li data-transition="fade" data-startalign="left,bottom" data-zoom="in" data-zoomfact="5" data-endalign="center,top" data-panduration="12" data-colortransition="4"> – this zoom effect and also the image path etc.
Any help greatly appreciated.. Thanks.
You need to predefine those values and store them inside the array you use. And don’t print ir out directly. It is better to store the output and print it out at the end:
Basically what you are doing right now is creating a loop in the size of 4 and printing out the same thing.