CMS Multiple Images

44 posts by 3 authors in: Forums > CMS Builder
Last Post: July 14, 2008   (RSS)

By edandrea - June 19, 2008 - edited: June 19, 2008

I am designing a site for a realestate agent. Have my listings page and in the process of creating a details page. To enable a larger image to show I created a separate upload section separate from the thumbnail upload. Now I don't know if this is an efficient way of doing this but I also want "Multiple Images" with previous and next showing one image at one time and not to display all at once is this possible? www.smoaklandco.com or is there a way to use a flash photo system where the photos are pulled into the flash that I could use for multiple images per listing?

There may have been only another thread that a user "matrix" was asking but I am not sure of outcome.

Re: [edandrea] CMS Multiple Images

By Dave - June 19, 2008

Hi edandrea,

The standard upload field lets you have 2 sizes - large images and thumbnails. So unless you need more sizes than that you may be able to get by with just one upload field.

I'm going to put together a demo for matrix later today, so I'll post that code if you want to see that in the other thread.

Also, if you want to use a flash photo system to scroll through photos you can do that as well. The key is to set it up in regular html first. Most flash photo scrollers use an XML file to list the photos. What you can do is have CMS Builder generate that XML file. I've seen this one used before: http://www.jeroenwijering.com/?item=jw_image_rotator

So there's a few options there. Hope that helps. Let me know if you need anything else.
Dave Edis - Senior Developer
interactivetools.com

Re: [edandrea] CMS Multiple Images

By Dave - June 20, 2008

The flash app usually don't care what the extension is, just that they send a XML content header.

Is there an url to an xml file that has a list of images used by the flash album?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CMS Multiple Images

By edandrea - June 20, 2008 - edited: June 20, 2008

http://www.smoaklandco.com/data.xml

But when I try to view it via a browser I get the following error:

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the [url "http://www.interactivetools.com/forum/forum.cgi?url=http%3A%2F%2Fjavascript%3Alocation.reload29"]Refresh[/#0000ff][/url] button, or try again later.


Only one top level element is allowed in an XML document. Error processing resource 'http://www.smoaklandco.com/data.xml'. ...<image>-^[/#0000ff]


-------------------------------------

In the data.xml file has a list of the following:

<image>
<pic>ds_detail_images/sc_21.jpg</pic>
<thumb>ds_detail_images/scthumb_21.jpg</thumb>
<title>David Smoak</title>
<desc>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur sit amet urna vel est laoreet interdum. Sed eget arcu. Phasellus ac est vel neque sagittis rutrum. Sed laoreet dolor ac pede. Sed arcu. Aenean tincidunt. Sed convallis, elit eget blandit consequat, ante arcu molestie nulla, vel feugiat nisi enim sit amet tortor. Nulla facilisi. Nullam placerat purus. Cras tincidunt. Vivamus diam est, accumsan vitae, fermentum vel, lacinia non, odio. Pellentesque ipsum leo, molestie nec, gravida vel, convallis nec, nisi. Phasellus vitae massa. Sed nulla nisl, porttitor id, egestas nec, sodales quis, ligula. Duis dapibus, elit nec ultrices malesuada, augue sapien sollicitudin ligula, quis mattis augue velit vel mauris. Aliquam erat volutpat. Cras in mi et orci vulputate venenatis. Suspendisse adipiscing ante.</desc>
</image>



Hope this helps you to help me.....

Re: [edandrea] CMS Multiple Images

By Dave - June 20, 2008

Looks good, just view source on that xml page to see the source. What you want to do is create a CMS Builder page (data.xml.php) that outputs the same thing but with images and content from CMS Builder.

Create a new single record section "Images" with a field for "uploads".

Upload some sample images. Then create a detail page viewer (single page viewer). Have it display the xml tags for each uploads. The code will look something like this:

<?php foreach ($imagesRecords['uploads'] as $upload): ?>
<image>
<pic><?php echo $upload['urlPath']; ?></pic>
<thumb><?php echo $upload['thumbUrlPath']; ?></thumb>
<title><?php echo $upload['info1']; ?></title>
<desc><?php echo $upload['info2']; ?></desc>
</image>
<?php endforeach; ?>

Play around with that and see if you can get it so when you view source on data.xml.php it looks like the same format as data.xml.

Finally, add this tag to the top of the page so it will tell flash it's a XML page, even if it doesn't end in .xml:

<?php header('Content-type: application/xml; charset=utf-8'); ?>

Give that a try and let me know if you get stuck along the way or need any more help or details.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CMS Multiple Images

By edandrea - June 23, 2008

Hi Dave and thanks again.

Have bee getting errors when I view the data.xml.php page: "Parse error: parse error, unexpected T_ENDIF in /home/content/s/m/o/smoaklandco/html/data.xml.php on line 23"

No photos are showing. Sorry about the amount of detail in this email.

The code on my page, and I have tried it several ways is:

<?php

require_once "/home/content/s/m/o/smoaklandco/html/cmsAdmin/lib/viewer_functions.php";

list($customRecords, $customDetails) = getRecords(array(
'tableName' => 'custom',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$customRecord = $customRecords[0]; // get first record

?>

<?php header('Content-type: application/xml; charset=utf-8'); ?>

<?php foreach ($customRecord['lg_photo'] as $upload): ?>
<image>
<pic><?php echo $upload['urlPath'] ?></pic>
<thumb><?php echo $upload['thumbUrlPath'] ?></thumb>
<title>David Smoak</title>
<desc>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur sit amet urna vel est laoreet interdum. Sed eget arcu. Phasellus ac est vel neque sagittis rutrum. Sed laoreet dolor ac pede. Sed arcu. Aenean tincidunt. Sed convallis, elit eget blandit consequat, ante arcu molestie nulla, vel feugiat nisi enim sit amet tortor. Nulla facilisi. Nullam placerat purus. Cras tincidunt. Vivamus diam est, accumsan vitae, fermentum vel, lacinia non, odio. Pellentesque ipsum leo, molestie nec, gravida vel, convallis nec, nisi. Phasellus vitae massa. Sed nulla nisl, porttitor id, egestas nec, sodales quis, ligula. Duis dapibus, elit nec ultrices malesuada, augue sapien sollicitudin ligula, quis mattis augue velit vel mauris. Aliquam erat volutpat. Cras in mi et orci vulputate venenatis. Suspendisse adipiscing ante.</desc>
</image>
<?php endif ?>
<?php endforeach ?>



I also tried it without the top segment and had it look very similar to yours and got the following errors:

<?php header('Content-type: application/xml; charset=utf-8'); ?>

<?php foreach ($customRecord['lg_photo'] as $upload): ?>
<image>
<pic><?php echo $upload['urlPath'] ?></pic>
<thumb><?php echo $upload['thumbUrlPath'] ?></thumb>
<title>David Smoak</title>
<desc>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur sit amet urna vel est laoreet interdum. Sed eget arcu. Phasellus ac est vel neque sagittis rutrum. Sed laoreet dolor ac pede. Sed arcu. Aenean tincidunt. Sed convallis, elit eget blandit consequat, ante arcu molestie nulla, vel feugiat nisi enim sit amet tortor. Nulla facilisi. Nullam placerat purus. Cras tincidunt. Vivamus diam est, accumsan vitae, fermentum vel, lacinia non, odio. Pellentesque ipsum leo, molestie nec, gravida vel, convallis nec, nisi. Phasellus vitae massa. Sed nulla nisl, porttitor id, egestas nec, sodales quis, ligula. Duis dapibus, elit nec ultrices malesuada, augue sapien sollicitudin ligula, quis mattis augue velit vel mauris. Aliquam erat volutpat. Cras in mi et orci vulputate venenatis. Suspendisse adipiscing ante.</desc>
</image>

<?php endforeach ?>



And got the folowing errors:

Warning: Cannot modify header information - headers already sent by (output started at /home/content/s/m/o/smoaklandco/html/data.xml.php:3) in /home/content/s/m/o/smoaklandco/html/data.xml.php on line 3

Warning: Invalid argument supplied for foreach() in /home/content/s/m/o/smoaklandco/html/data.xml.php on line 5



Then I added back in the "<?php endif ?>" before the "<?php endforeach ?>"

and I get on the data.xml.php page= "Parse error: parse error, unexpected T_ENDIF in /home/content/s/m/o/smoaklandco/html/data.xml.php on line 12



No Photos



Re: [edandrea] CMS Multiple Images

By Dave - June 23, 2008

Ok, if you like I can FTP in and have a look, just email me ftp info and the url that XML file to dave@interactivetools.com (email, don't post login details to forum). I can take a look and/or fix it and post the details back here.

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

Re: [Dave] CMS Multiple Images

By edandrea - June 23, 2008

I wanted to also let you know that in my flash movie I changed xmlData.load("data.xml"); to xmlData.load("data.xml.php");, since I renamed the file extension.

Re: [edandrea] CMS Multiple Images

By Dave - June 23, 2008

Ok, I got it working. You can see it here:

Here's what I did:
- I removed the <?php endif ?> (on line 25)
- I change the fieldname from 'lg_photo' to 'image' (there was no photos uploaded for lg_photo)
- I found that when there was no images, there was no output, and my browser just loaded forever waiting for content, so I added this message if there is no images:

<?php if (!@$customRecord['image']): ?>
No Images Found
<?php endif; ?>

You can see it working here:
http://www.smoaklandco.com/data.xml.php

Feel free to change those 'image' fieldnames back to 'lg_photo' when you get some uploads in there.

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