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
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
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.
interactivetools.com
Re: [Dave] CMS Multiple Images
By edandrea - June 20, 2008
I have created my "Flash Photo album" at http://www.smoaklandco.com/ds_detail2.php as you suggested and it is working fine. Now I am a little confused as to how CMS is going to output to XML. From reading the other posts it looks like I need to change my file extension where my photos are to .xml.php? And then I paste the code into the .xml.php file? Anyway I have added some photos into a file and linked them from the .xml.
How do I now get the uploaded images to load into flash photo?
Many thanks in advance for your support.
Emil
Re: [edandrea] CMS Multiple Images
By Dave - June 20, 2008
Is there an url to an xml file that has a list of images used by the flash album?
interactivetools.com
Re: [Dave] CMS Multiple Images
By edandrea - June 20, 2008 - edited: June 20, 2008
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
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.
interactivetools.com
Re: [Dave] CMS Multiple Images
By edandrea - June 23, 2008
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
Let me know if that works for you.
interactivetools.com
Re: [Dave] CMS Multiple Images
By edandrea - June 23, 2008
Re: [edandrea] CMS Multiple Images
By Dave - June 23, 2008
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! :)
interactivetools.com