trouble reading xml.php file

6 posts by 2 authors in: Forums > CMS Builder
Last Post: September 17, 2009   (RSS)

I am attempting to integrate the PHP calendar script mentioned in this post:
http://www.interactivetools.com/iforum/Products_C2/CMS_Build
er_F35/gforum.cgi?post=74229;search_string=calendar;t=search
_engine#74229

This calendar script gets its data from an xml file.

Viewing the xml file at it's address it appears to be bringing in data from CMS Builder database, but I've not been able to get the PHP calendar page that calls the xml file to display the CMS data.

In the calendar script, the name of the xml file is referenced as:
calendar.xml

I have changed that to match the xml file name:
calendar.xml.php


Here's my XML code:

<?php header('Content-type: application/xml; charset=utf-8'); ?>
<?php
require_once "/vservers/mydomain/htdocs/cmsAdmin/lib/viewer_functions.php";
list($calendarRecords, $calendarMetaData) = getRecords(array(
'tableName' => 'calendar',
));
?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<calendar>
<?php foreach ($calendarRecords as $record): ?>
<event>
<date><?php echo date("Y-m-d", strtotime($record['date'])) ?></date>
<title><?php echo $record['title'] ?></title>
<url><?php echo $record['url'] ?></url>
</event>
<?php endforeach; ?>
</calendar>


When I view source of the xml.php file in my browser I see this, which is correct:

<?xml version="1.0" encoding="UTF-8"?><calendar>
<event>
<date>2009-10-26</date>
<title>My Event</title>
<url>http://www.test.com</url>
</event>
</calendar>


Any tips or advice would be much appreciated. If I could get this to work, it would make my week!

Deborah

Re: [Deborah] trouble reading xml.php file

By Chris - September 15, 2009

Hi Deborah,

Your XML output looks good to me, but I've never used xmlCalendar and I'm not sure what they're expecting. I suspect it might be a date format mismatch.

Do you have an example of what the XML is supposed to look like?
All the best,
Chris

Re: [chris] trouble reading xml.php file

Chris,

I'm wondering if you may be onto something with the date formatting. For the XML file the date needs to be read as:
YYYY-MM-DD

That formatting seems to be coming through correctly, as indicated in my example above, however, the public PHP page doesn't show any of the data generated for the .xml.php page.

I'd be happy to send login credentials to the test files.

Deborah

Re: [Deborah] trouble reading xml.php file

By Chris - September 15, 2009

Hi Deborah,

I'm afraid we can't provide support for third-party scripts, but if you can show us the format of the XML you want to output, we can help you write some code to output your CMS Builder data in the same format.

See if you can generate an XML file by hand which works with the xmlCalendar software. A "hello world," if you will. Did it come with any examples?
All the best,
Chris

Re: [Deborah] trouble reading xml.php file

By Chris - September 17, 2009

Glad to hear you got this working! :)
All the best,
Chris