Display data in a DIV

9 posts by 3 authors in: Forums > CMS Builder
Last Post: May 23, 2012   (RSS)

By Rewmer - May 23, 2012

I am trying to get my data for my list page and detail pages to display in seperate DIVs rather than tables. I want the DIV to be created for each record loaded rather than have a set number of DIVS on the page which I have done here - http://www.genetic-gems.com/pages/royalavailabledetail.php?2 - as you can see as I only have two images I am still getting the bottom borders of the empty DIVS showing... I wish I knew more PHP [mad]

Can anyone give me a quick heads up on how to acheive this ?

Re: [Rewmer] Display data in a DIV

By zip222 - May 23, 2012

Can you post the code you are currently using for that section of the page?

Re: [zip222] Display data in a DIV

By Rewmer - May 23, 2012

Here is the code, I have a seperate DIV for each upload.



<div class="innercontent">Clutch No.: <?php echo htmlencode($avaliable_royal_pythonsRecord['clutch_no']) ?><br/>
Breeding: <?php echo htmlencode($avaliable_royal_pythonsRecord['breeding']) ?><br/>
Description: <?php echo $avaliable_royal_pythonsRecord['description']; ?><br/>

<blockquote>

<?php foreach ($avaliable_royal_pythonsRecord['picture_1'] as $index => $upload): ?>

<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
<?php endforeach ?>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/>

</blockquote>

</div>



<div class="innercontent">


<blockquote>
<?php foreach ($avaliable_royal_pythonsRecord['picture_2'] as $index => $upload): ?>

<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Gems Code) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Animal) : <?php echo htmlencode($upload['info2']) ?><br/>
info3 (Price) : <?php echo htmlencode($upload['info3']) ?><br/>
<?php endforeach ?>

</blockquote></div>


<div class="innercontent"><blockquote>
<?php foreach ($avaliable_royal_pythonsRecord['picture_3'] as $index => $upload): ?>


<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/><br/>


<?php endforeach ?>
</blockquote></div>



<div class="innercontent"><blockquote>
<?php foreach ($avaliable_royal_pythonsRecord['picture_4'] as $index => $upload): ?>


<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/><br/>
<?php endforeach ?>
</blockquote></div>


<div class="innercontent"><blockquote>
<?php foreach ($avaliable_royal_pythonsRecord['picture_5'] as $index => $upload): ?>



<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/><br/>

<?php endforeach ?>

</blockquote></div>




<div class="innercontent"><blockquote>

<?php foreach ($avaliable_royal_pythonsRecord['picture_6'] as $index => $upload): ?>

<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/><br/>

<?php endforeach ?>
</blockquote>
</div>



<div class="innercontent">
<blockquote>

<?php foreach ($avaliable_royal_pythonsRecord['picture_7'] as $index => $upload): ?>


<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/><br/><?php endforeach ?>


</blockquote>
</div>
<div class="innercontent">
<blockquote>
<?php foreach ($avaliable_royal_pythonsRecord['picture_8'] as $index => $upload): ?>


<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/><br/>
<?php endforeach ?>
</blockquote>
</div>



<div class="innercontent">
<blockquote>
<?php foreach ($avaliable_royal_pythonsRecord['picture_9'] as $index => $upload): ?>

<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/><br/>
<?php endforeach ?>
</blockquote>
</div>
<div class="innercontent">
<blockquote>

<?php foreach ($avaliable_royal_pythonsRecord['picture_10'] as $index => $upload): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Price) : <?php echo htmlencode($upload['info2']) ?><br/>

<?php endforeach ?>

</blockquote>
</div>


<h5><a href="<?php echo $avaliable_royal_pythonsMetaData['_listPage'] ?>">&lt;&lt; Back to Available Page</a></h5>
</div>

Re: [Rewmer] Display data in a DIV

By zip222 - May 23, 2012

What you need to do is add an if statement to each one of these. Below is an example for the first image upload. The only things that have been added are the very first and very last lines.

<?php if($avaliable_royal_pythonsRecord['picture_1']): ?>

<div class="innercontent">
<blockquote>
<?php foreach ($avaliable_royal_pythonsRecord['picture_1'] as $index => $upload): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
info1 (Gems Code) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Animal) : <?php echo htmlencode($upload['info2']) ?><br/>
info3 (Price) : <?php echo htmlencode($upload['info3']) ?><br/>
<?php endforeach ?>
</blockquote>
</div>

<?php endif; ?>

Re: [zip222] Display data in a DIV

By Rewmer - May 23, 2012

Thanks zip, I just knew it would be simple. I will give that a go shortly and let you know how I get on.
Thanks again.

Re: [zip222] Display data in a DIV

By Rewmer - May 23, 2012

Nice work Zip, Sooo simple, she is looking fine now. Thanks very much.

Re: [zip222] Display data in a DIV

By ross - May 23, 2012

Hi there

Thanks for helping out on this one! Sounds like exactly what was needed. Appreciate your effort :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [Rewmer] Display data in a DIV

By ross - May 23, 2012

Hi there

Thanks for the update! Glad to hear you got things going. Keep us all update with how you are making out.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/