Print Image Title

10 posts by 4 authors in: Forums > CMS Builder
Last Post: March 3, 2009   (RSS)

Hi, Is there a way to display the image title and caption beside or beneath an uploaded image?

Re: [Dan Maitland] Print Image Title

By Kenny - February 22, 2009 - edited: February 22, 2009

Dan,

Use echo statements to do this like any other data. For example:

<?php echo $upload['info1'] ?> will display what ever you have that textfield set to. In this case, you probably have info1 set to "Title"

<?php echo $upload['info2'] ?> will display your second textfield


Make sense?


Kenny

Re: [sagentic] Print Image Title

By gkornbluth - February 22, 2009 - edited: February 22, 2009

Or you could create separate title or other fields in your section editor and use the same echo statement approach. As always, there's more than one way to approach any issue.

Hope that helps.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [sagentic] Print Image Title

Sagentic
Thank you for responding. If I want to upload an image and have its title and/or caption underneath/beside it I would insert the code:

<?php echo $upload['info1'] ?>

Where would I put this code exactly? I understand the principal and even tried it but I'm not sure i placed it in the right place. Can you clear that up for me. Thanks.

Re: [sagentic] Print Image Title

I can't thank you enough. Thank you. It works great.

Re: [Dan Maitland] Print Image Title

Hey Kenny... I know I must be doing something wrong... but I'm inserting the code you mentioned in this thread and it's not showing up on the page. The website is http://www.integritymh.com/mezzanine_shelving.php and Here's the code:

<?php foreach ($mezzanine_shelvingRecord['photo'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<?php elseif ($upload['isImage']): ?>
<br/>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br /><?php echo $upload['info1'] ?>
<br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>"><?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
John Tedesco

Creative Director



JAM Graphics

Re: [jtedescojam] Print Image Title

By Kenny - March 3, 2009

The code looks good from what I can tell, so the only thing I can think of is to check and see if you have those fields enabled on your uploads.

Under Advanced Options for the "Photos" do you have anything listed next to info1, info2, etc....?


Kenny

Re: [sagentic] Print Image Title

Yes, Title, is in the "info1" box.

This is strange, because it worked without a problem anywhere I placed that code after the 'foreach' statement and BEFORE the 'elseif' statement, and also worked when I placed it after the 'endif' stament.

So it's working now... it's going to be very difficult to get the caption to fall under each image perfectly (because I have float and margin styles attached to these images.)

Wondering, can you tell me how to write this code so the thumbnail is clickable to a bigger image?

Thank you for the quick response.
John Tedesco

Creative Director



JAM Graphics

Re: [jtedescojam] Print Image Title

By Kenny - March 3, 2009

Glad you got it working.

Try this tutorial I wrote a while back for making your images larger.

http://www.interactivetools.com/forum/gforum.cgi?post=64222#64222

There are many ways to do it, bu this one has some cool effects to it.

Kenny