CMS going great BUT challenge with 2 image situations

6 posts by 2 authors in: Forums > CMS Builder
Last Post: February 21, 2008   (RSS)

By Codee - February 17, 2008 - edited: March 30, 2013

Hi!
I'm a newbie with NO pHp or MySQL direct experience but CMS, with the help of Dave and Co., is really easy for the most part. I have one challenge and a related question...
first, here is the list url to show how far I am and where I'm at:
http://www.customersitename.com/customList.php

1) How do I get a single thumbnail (first one uploaded) to appear on the List page?

and,

2) How come the title and caption for the photos are not appearing on the custom records pages? How do I correct that?

Thanks for your expeditious help in advance

Re: [equinox69] CMS going great BUT challenge with 2 image situations

By Dave - February 17, 2008

Looking good! Here's how to do what you want:

To get images to display on the list page you just copy the "STEP3: Display Uploads" block from the page viewer to the list viewer.

If you want just the first image only, you can use add a tag to stop looping through the images after 1 ("break"ing out of the loop) . That looks like this: <?php break; ?>

And title and caption fields (or any extra info fields you've created for uploads) are available as info1, info2, info3, info4, info5. You'd display them like this: <?php echo $upload['info1'] ?>

Putting that all together you'd add something like this to step 2 (List Records) to your customList.php.

<?php foreach ($listRows as $record): ?>

...


<?php foreach (getUploads($options['tableName'], 'uploads', $record['num']) as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>

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

<?php endif ?>
<?php endforeach ?>

...

<?php endforeach ?>


Let me know if that works for you or if you need additional details.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CMS going great BUT challenge with 2 image situations

By Codee - February 17, 2008 - edited: March 30, 2013

Dave,

1) for the single thumbnail on the customList.php page I think I can handle the info you gave. I'll write if I get into trouble.

2) for the other issue of title and caption fields...the problem IS ON the customPage.php...I don't want the captions and title on the customList.php page...so cutting and pasting from the customPage.php isn't the issue. The issue is that the captions and titles on the customPage.php aren't showing.

Re: [equinox69] CMS going great BUT challenge with 2 image situations

By Dave - February 18, 2008

Ok, try adding these tags to customPage.php:

<?php foreach (getUploads($options['tableName'], 'uploads', $record['num']) as $upload): ?>
...

<?php echo $upload['info1'] ?><br/>
<?php echo $upload['info2'] ?><br/>


...
<?php endforeach ?>


Basically you just need to manually add them. info1 is title and info2 if caption. Just copy and paste those tags where ever you want the title and caption to be.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CMS going great BUT challenge with 2 image situations

By Codee - February 20, 2008 - edited: March 30, 2013

Dave,

finally got both image issues squared away, just took a little more finagling, and it works, thanks for the direction.
it's coming along nicely:
http://www.sitename.com/customList.php