Generating XML using CMS

15 posts by 3 authors in: Forums > CMS Builder
Last Post: December 27, 2008   (RSS)

Halleleujah!!! It works now - God Bless You!

By meg - December 23, 2008

Hi Dave.

I seem to be having a problem with my XML gallery with the CMS and I believe I narrowed it down. My XML is looking for a URL, while the CMS referencing the file path in the file system. How do I correct for this?

I changed the upload field directory to the folder where I originally put my photos to test the gallery. (If I switch my XML to read just the file name, I can view the gallery just fine.) Is it possible to modify the php so it just reads the file name? And in regards to the caption, what should I do? I'm experiencing the same problem with the caption URL vs. file path.

Here's a sample of my xml code:

<?php echo('<?xml version="1.0" encoding="utf-8"?>'); ?>
<?php

require_once "/data/home/riverschoolboats/websites/riverschoolboats.com/docs/cms/lib/viewer_functions.php";

list($artistRecords, $artistMetaData) = getRecords(array(
'tableName' => 'artist',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$artistRecord = @$artistRecords[0];

?>
<config>
<baseurl>/images/</baseurl>
<fadetime>2</fadetime>
<showtime>3</showtime>
<window>_top</window>
<randomorder>true</randomorder>
<texts>true</texts>
<movingtext>true</movingtext>
<mouseover>true</mouseover>
<textposition>2</textposition>

<?php foreach ($artistRecords['uploads'] as $upload): ?>
<image>
<url><?php echo $upload['urlPath']; ?></url>
<caption><?php echo $upload['info1']?>"</caption>
</image>
<?php endforeach; ?>
</config>

Also, if I plan on uploading multiple images to this gallery, do I need to repeat this code to match the desired number of photos per gallery, or will it generate multiple images with this code appearing once?

<image>
<url><?php echo $upload['urlPath']; ?></url>
<caption><?php echo $upload['info1']?>"</caption>
</image>

Re: [meg] Generating XML using CMS

By Dave - December 23, 2008

Hi meg,

Can you give an example of the lines that it's outputting now (just the ones you want to change), and what you want it to output instead? Once I have that I can give you some code to generate that.

Also, while debugging the xml, it's a good practice to get it working with a plain text .xml file first, then once you know it's working, have CMS Builder generate an xml file that looks the same. It makes it easier to track down problems.

Hope that helps, let me know about the output.
Dave Edis - Senior Developer
interactivetools.com

Re: [meg] Generating XML using CMS

By Dave - December 27, 2008

Hi Meg,

It might be quickest if I could just take a look at the code directly. If that works for you just email CMS and FTP login details to dave@interactivetools.com (email, don't post login details to the forum). And also include the url to the plain text xml file that is working, the php version that isn't, and the flash page that displays them.

I'll post back here or via email with the solution. Hope that helps!
Dave Edis - Senior Developer
interactivetools.com