XML output from CMSBuilder
3 posts by 2 authors in: Forums > CMS Builder
Last Post: December 3, 2007 (RSS)
By aev - December 3, 2007
Hi!
Is it somehow possible to have a "file upload field" in CMSBuilder produce a xml file?
I think this would be fairly simple using AM2, but am not sure how to do this with CMSBuilder. To explain this a bit more; what I would like to do is to make a XML based XSPF playlist for a flash based MP3 player, from a user's uploads. One <track> for each upload, and if CMSBuilder had fields for Image Title and Image Caption like in AM2, we could use those fields for <title> and <creator>.
Like this:
Any suggestions? Can I make CMSBuilder run a custom PHP script on save? Then I could make the XML file from there?
-aev-
Is it somehow possible to have a "file upload field" in CMSBuilder produce a xml file?
I think this would be fairly simple using AM2, but am not sure how to do this with CMSBuilder. To explain this a bit more; what I would like to do is to make a XML based XSPF playlist for a flash based MP3 player, from a user's uploads. One <track> for each upload, and if CMSBuilder had fields for Image Title and Image Caption like in AM2, we could use those fields for <title> and <creator>.
Like this:
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<title>Song title 1</title>
<creator>Creator 1</creator>
<location>http://www.mysite.com/cmsAdmin/uploads/song_title_1.mp3</location>
</track>
<track>
<title>Song title 2</title>
<creator>Creator 2</creator>
<location>http://www.mysite.com/cmsAdmin/uploads/song_title_2.mp3</location>
</track>
</trackList>
</playlist>
Any suggestions? Can I make CMSBuilder run a custom PHP script on save? Then I could make the XML file from there?
-aev-
Re: [aev] XML output from CMSBuilder
By Dave - December 3, 2007
CMS Builder doesn't have extra fields (title, caption) for uploads yet. So the only way to do it would be to have lots of single file upload fields with 2 extra fields for each one for the Title and Creator. Then limit each upload field to only allow 1 upload.
If that would be alright, producing the XML should be pretty easy. Just use the code generator and replace all the HTML tags with XML. Let me know if you need help with that part.
I'll add "title" and "caption" fields for uploads to the feature request list. We're redoing the upload part soon so we may be able to get that one added sooner rather than later.
If that would be alright, producing the XML should be pretty easy. Just use the code generator and replace all the HTML tags with XML. Let me know if you need help with that part.
I'll add "title" and "caption" fields for uploads to the feature request list. We're redoing the upload part soon so we may be able to get that one added sooner rather than later.
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] XML output from CMSBuilder
By aev - December 3, 2007
Thanks for pointing me in the right direction!
I created this XML "page"...
...and it worked great!
This multipage menu is now feeding a Flash based MP3 player with Creator Name, Track Title and the actual MP3 file.
-aev-
I created this XML "page"...
<?php
require_once "/path_to_www_root/lib/viewer_functions.php";
$options = array();
$all_the_other_options...
?>
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1"
xmlns = "http://xspf.org/ns/0/">
<trackList>
<?php foreach ($listRows as $record): ?>
<track>
<creator><?php echo $record['creator'] ?></creator>
<title><?php echo $record['title'] ?></title>
<location><?php foreach (getUploads($options['tableName'], 'mp3', $record['num']) as $upload): ?><?php echo $upload['urlPath'] ?><?php endforeach ?></location>
</track>
<?php endforeach ?>
</trackList>
</playlist>
...and it worked great!
This multipage menu is now feeding a Flash based MP3 player with Creator Name, Track Title and the actual MP3 file.
-aev-