Complete XML output

10 posts by 3 authors in: Forums > CMS Builder
Last Post: March 10, 2008   (RSS)

By Dennis de Rooy - January 22, 2008

I was reading about someone managed to output data in xml for a mp3 player. I was wondering if it's possible to output everything in xml so I can use cms builder for a cms for Flash.

I'm looking to use it for sites with an image gallery (with thumbs), a blog, mp3 player, .flv movie player and some text pages. Would it be possible to make these directories in CMS builder and that every directory outputs an xml with its content?

Thanks, Dennis

Re: [Dennis de Rooy] Complete XML output

By Dave - January 22, 2008

Absolutely! When you create your viewers just remove the HTML and replace with XML tags. Also, instead of the regular tag to display a field:

<?php echo $record['fieldname'] ?>

use the PHP function htmlspecialchars() to encode the content as HTML entities so it's valid XML.

<?php echo htmlspecialchars($record['fieldname']); ?>

If you need any help with this just let us know. We'd love to see a flash based site updated with CMS Builder. I think you might be the first.

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

Re: [Dave] Complete XML output

By Dennis de Rooy - January 24, 2008

Hi Dave,

thanks for the reply, just what I wanted to hear. If I get CMS builder to output clean xml, I can build a flash site which content is created and managed by CMS builder. I'm going to give it a shot with the 10 day trial.

I'll keep you updated on my progress. When I get the first working demo I can start building full sites.



Cheers, Dennis

Re: [Dennis de Rooy] Complete XML output

By Dave - January 24, 2008

Great, can't wait to see it. Let me know if you get stuck with anything.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dennis de Rooy] Complete XML output

By aev - January 24, 2008

Hi!

I think you are referring to my post on the mp3/xml case I had.

I just wanted to let you know that it is only possible to make "web-retrievable" xml output with CMS Builder not actual xml files on the web server's file system. This means that if your flash file reads it's xml data from a url like http://domain.com/content.xml and NOT from the filesystem like /your_web_root_path/domain.com/content.xml everything will work fine.

Another issue is that unless you set your webserver to parse all files for PHP code you must name your xml files with a PHP extension. Like this: content.xml.php. In my case this was not a problem, but if the system/application reading your xml files is picky about extension it could be a problem.

Using AM2's publish technology it would be possible to create actual xml FILES in your filesystem. But after using both I would definitely go for CMS Builder if you can use http urls for xml data in your Flash site.

Dave, please correct me if I'm wrong on this.. maybe CMS Builder can do more than I know [:)]


Regards,
AEV

Re: [aev] Complete XML output

By Dennis de Rooy - January 24, 2008

Thanks AEV for the heads up. You can use the php file to return xml and use that in flash. I have cms builder installed right now and I'm going to do the first run now. I'll keep you guys updated here.



Cheers, Dennis

Re: [aev] Complete XML output

By Dave - January 24, 2008

Thanks aev,

It's true, all the CMS Builders files end in .php and run through the web server. You can do things like .xml.php but they still end in PHP.

If anyone needs to be able to access it through the filesystem or needs a .xml extension let me know. There's a few tricks with Apache .htaccess files and other things we could try to make that work. Try it the other way first, though.

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

Re: [Dave] Complete XML output

By Dennis de Rooy - March 6, 2008

Hi Dave,

I finally have some time to get CMSbuilder to output XML. I changed the markup but where can I see the output pages? I can't seem to find the actual pages...[:/]

Thanks

P.s. If you need a peek at my files let me know

Re: [Dennis de Rooy] Complete XML output

By Dave - March 6, 2008

You can generate a viewer code here:
Admin > Section Editors > Your Section > Show PHP Viewer Code.

Basically you just save that code in a file on your server such as:
http://yourDomain/xmlPage.php

You'll only have one file, but that one file will be able to output different content with different urls. So for example xmlPage.php?1 would load record 1, etc.

The one thing you want to watch for, is since there isn't a .xml extension you'll need to send a header to tell the browser that it's XML. Just add this after your PHP tag:

<?php

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


Hope that helps. Let me know if you have any other questions or if you need more details.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Complete XML output

By Dennis de Rooy - March 10, 2008

Thanks Dave! That works like a charm. Now I need to do the flash bit ;)

I will post the results.

Cheers, Dennis