hello
how cant i sort an array in to div in pairs (odd and even) ?
so i have the numbers 1 to 50 for a book
i want the first number and last number to be front and back pages.
ie.
1
2+3
3+4
4+5
5+6
7
this is the div structure
im giving the front cover a class of fCover then left for the left pages and right for the right pages.
<div class="bb-custom-wrapper"> <div id="bb-bookblock" class="bb-bookblock"> //FRONT PAGE <div class="bb-item" id="item1"> <div class="content"> <div class="scroller fCover"> <img src="assets/images/pages/1.jpg" ALT="page1"> </div> </div> </div> //PAGES 2 & 3 <div class="bb-item" id="item2"> <div class="content"> //PAGE 2 <div class="scroller left"> <img src="assets/images/pages/2.jpg" ALT="page2"> </div> //PAGE 3 <div class="scroller right"> <img src="assets/images/pages/3.jpg" ALT="page3"> </div> </div> </div> </div> </div>
This is the php that i have:
<div class="bb-custom-wrapper"> <div id="bb-bookblock" class="bb-bookblock"> <?php foreach($pageImg as $file){ echo' <div class="bb-item" id="item'.$file.'"> <div class="content">'; if($file == "1"){ echo' <div class="scroller fCover"> <img src="assets/images/pages/'.$file.'.jpg" ALT="page'.$file.'"> </div>'; } echo' </div> </div>'; }?> </div></div>
that give me the first page but im stuck on the paired pages ?
thanks
rick