XML issue
4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 12, 2009 (RSS)
By s2smedia - February 11, 2009 - edited: February 11, 2009
I have an xml flash calendar pulling in data from an xml doc.
I searched the forum to find out how to do it but im still having problems.. Its not pulling any data in.
I turned my xml doc into a php doc (ex. events.xml.php) I set this new file name within my flash file
Heres my xml code:
<?php header('Content-type: application/xml; charset=utf-8'); ?>
<?php
require_once "XXXXXXXX";
list($eventsRecords, $eventsMetaData) = getRecords(array(
'tableName' => 'events',
));
?>
<events>
<?php foreach ($eventsRecords as $record): ?>
<event>
<date><?php echo date("d m Y", strtotime($record['date_time'])) ?></date>
<time><?php echo date("g:i a", strtotime($record['date_time'])) ?></time>
<title><?php echo $record['title'] ?></title>
<image><?php foreach ($record['image'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
</image>
<?php endif ?>
<?php endforeach ?>
<description>
<![CDATA[<?php echo $record['content'] ?>]]>
</description>
<link><a href="<?php echo $record['_link'] ?>">Get Tickets</a></link>
</event>
<?php endforeach; ?>
<?php if (!$eventsRecords): ?>
<?php endif ?>
</events>
I searched the forum to find out how to do it but im still having problems.. Its not pulling any data in.
I turned my xml doc into a php doc (ex. events.xml.php) I set this new file name within my flash file
Heres my xml code:
<?php header('Content-type: application/xml; charset=utf-8'); ?>
<?php
require_once "XXXXXXXX";
list($eventsRecords, $eventsMetaData) = getRecords(array(
'tableName' => 'events',
));
?>
<events>
<?php foreach ($eventsRecords as $record): ?>
<event>
<date><?php echo date("d m Y", strtotime($record['date_time'])) ?></date>
<time><?php echo date("g:i a", strtotime($record['date_time'])) ?></time>
<title><?php echo $record['title'] ?></title>
<image><?php foreach ($record['image'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
</image>
<?php endif ?>
<?php endforeach ?>
<description>
<![CDATA[<?php echo $record['content'] ?>]]>
</description>
<link><a href="<?php echo $record['_link'] ?>">Get Tickets</a></link>
</event>
<?php endforeach; ?>
<?php if (!$eventsRecords): ?>
<?php endif ?>
</events>
Re: [s2smedia] XML issue
By Dave - February 11, 2009
Hi s2smedia,
The code looks good to me. The next steps to track down the problem are as follows:
- Confirm that your flash calendar works with a static (text) xml file such as events.xml.
- Run both your files through an xml validater such as http://www.validome.org/xml/ (or google for more) and correct any errors.
- If it works, compare the output of events.xml and events.xml.php (view source in your browser or use a file comparison tool such as WinMerge).
- Make the files match exactly and test again. If there's still a problem, post (or email me) the urls and we can take a look.
If you can get it to work with a regular .xml file you can usually get it to work with a .php file that outputs the same content. Usually it's just a difference in the output.
Let us know what happens! :)
The code looks good to me. The next steps to track down the problem are as follows:
- Confirm that your flash calendar works with a static (text) xml file such as events.xml.
- Run both your files through an xml validater such as http://www.validome.org/xml/ (or google for more) and correct any errors.
- If it works, compare the output of events.xml and events.xml.php (view source in your browser or use a file comparison tool such as WinMerge).
- Make the files match exactly and test again. If there's still a problem, post (or email me) the urls and we can take a look.
If you can get it to work with a regular .xml file you can usually get it to work with a .php file that outputs the same content. Usually it's just a difference in the output.
Let us know what happens! :)
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] XML issue
it works when i use plain text in the xml document... and also when i use plain text in the xml.php doc. So it must be the code in the CMS version.
Heres my code again just incase you might see something.
<?php header('Content-type: application/xml; charset=utf-8'); ?>
<?php
require_once "/XXXXXXXX";
list($eventsRecords, $eventsMetaData) = getRecords(array(
'tableName' => 'events',
));
?>
<events>
<?php foreach ($eventsRecords as $record): ?>
<?php foreach ($record['image'] as $upload): ?>
<event>
<date><?php echo date("d m Y", strtotime($record['date_time'])) ?></date>
<time><?php echo date("g:i a", strtotime($record['date_time'])) ?></time>
<title><?php echo $record['title'] ?></title>
<image><img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /></image>
<description>
<![CDATA[<?php echo $record['content'] ?>]]>
</description>
<link><![CDATA[<a href="<?php echo $record['_link'] ?>">Get Tickets</a></link>
</event>
<?php endif ?>
<?php endforeach ?>
<?php endforeach; ?>
<?php if (!$eventsRecords): ?>
<?php endif ?>
</events>
Heres my code again just incase you might see something.
<?php header('Content-type: application/xml; charset=utf-8'); ?>
<?php
require_once "/XXXXXXXX";
list($eventsRecords, $eventsMetaData) = getRecords(array(
'tableName' => 'events',
));
?>
<events>
<?php foreach ($eventsRecords as $record): ?>
<?php foreach ($record['image'] as $upload): ?>
<event>
<date><?php echo date("d m Y", strtotime($record['date_time'])) ?></date>
<time><?php echo date("g:i a", strtotime($record['date_time'])) ?></time>
<title><?php echo $record['title'] ?></title>
<image><img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /></image>
<description>
<![CDATA[<?php echo $record['content'] ?>]]>
</description>
<link><![CDATA[<a href="<?php echo $record['_link'] ?>">Get Tickets</a></link>
</event>
<?php endif ?>
<?php endforeach ?>
<?php endforeach; ?>
<?php if (!$eventsRecords): ?>
<?php endif ?>
</events>
Re: [s2smedia] XML issue
By Dave - February 12, 2009
Can you post the url to both xml files (or email me if they're private to dave@interactivetools.com) so I can compare?
Let me know which one is working and which one isn't and I'll take a look.
Let me know which one is working and which one isn't and I'll take a look.
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com