xml output

9 posts by 2 authors in: Forums > CMS Builder
Last Post: October 30, 2008   (RSS)

By rez - October 27, 2008 - edited: October 27, 2008

I found this thread that looks like what i want to do is possible. I can kind of look at the code and understand it, but i don't know PHP to be able to write it. And I can see that I pretty much don't have to (although I am open for it to customize cmsbuilder) Here is the link. i didn't know whether to start this new thread or bring up the old one, sorry:

http://www.interactivetools.com/iforum/Products_C2/gforum.cgi?post=58187;search_string=xml%20file;guest=29344249&t=search_engine#58187

What i want to do is use CMSBuilder to output xml. Here is example xml:

<?xml version="1.0" encoding="utf-8"?>
<news_ticker>
<settings totalWidth="594" totalHeight="600" blurme="1"></settings>
<news title="Title 1" subtitle="subtitle 1" picture="thumbnails/16.jpg" date="08-08-08" bigTitle="This is a big title" bigPicture="pictures/16.jpg">
<description><![CDATA[This is long description 1]]></description>
</news>
<news title="Title 2" subtitle="subtitle 2" picture="thumbnails/16.jpg" date="08-09-08" bigTitle="big title 2" bigPicture="pictures/16.jpg">
<description><![CDATA[This is long description 2]]></description>
</news>
</news_ticker>

Re: [rez] xml output

By rez - October 27, 2008 - edited: October 27, 2008

My post gets cut off after the code above. ? Here is the rest:


The settings can be a hard coded and will not change.

Questions:
  1. Can someone show me what the xml file would look like in the way that the last entry in the thread i linked to does?
  2. So this xml file, is actually a php file. Is my understanding correct that the browser will run the php and when flash imports it, it will see it as an original xml file like my code above? However that works, the bottom line is that i just point flash to mynews.xml.php, correct?
  3. Can I have a text bar in the editor for the cdata text entries so that the client can use simple formatting for flash html? There are a few differences like for bold and font, etc. when it comes to flash html.
  4. Can I use a file browser/ wysiwyg editor for the picture entries so the client browses for a picture instead of typing a link? I need some direction here. Maybe it's the same for using any picture in an editor and I just use the right code in the xml file?
  5. Is there a way to handle the auto thumbnail filed and larger picture field with cmsbuilder so again, the client doesn't see any code but the end result is the correct xml format like my example above? Possibly a redundant question. Just seems a little different to auto create a thumb while uploading, then somehow filling in the xml node with it. In other words, they would probably upload bigPicture, and a thumb would be created and the link would be the picture (thumb) node. By the way, i ma using flash to do all the positioning, so none of those options should be available to the client in the editor.



thanks. I probably need these answers before getting into cmsbuilder. I have already purchased and will get my hands dirty with this info when my purchase links arrive. Thanks for any help. Excuse any spelling errors. The spell check froze and i lost my whole entry the first time.

Re: [rez] xml output

By Dave - October 27, 2008

Hi rez, welcome to the CMS Builder forum!

The post you linked to and these docs on creating an RSS feed have details on creating XML pages with CMS Builder: http://www.interactivetools.com/docs/cmsbuilder/rss_feeds.html

Basically CMS Builder doesn't care if it's outputting HTML or XML, it's all just text and tags.

>Can someone show me what the xml file would look
>like in the way that the last entry in the thread i linked
>to does?

I can't write the code for you, but I can point you in the right direction. The first step is to create a mockup XML file, then get CMS builder to re-create that file with data from the database.

>So this xml file, is actually a php file. Is my
>understanding correct that the browser will run the
>php and when flash imports it, it will see it as an original
>xml file like my code above? However that works, the
>bottom line is that i just point flash to mynews.xml.php, correct?

Yes, as far as flash is concerned it's an XML file. It will never see the PHP, just the XML output the php creates.

>Can I have a text bar in the editor for the cdata text entries so that
>the client can use simple formatting for flash html? There are a few
>differences like for bold and font, etc. when it comes to flash html.

We use the popular open source wysiwyg called tinymce. The wysiwyg can be customized but you're need to research how to do that. The wysiwyg config file can be found here: /cmsAdmin/lib/wysiwyg.php and the online docs here: http://wiki.moxiecode.com/index.php/TinyMCE:Index

>Can I use a file browser/ wysiwyg editor for the picture entries
>so the client browses for a picture instead of typing a link? I
>need some direction here. Maybe it's the same for using any
>picture in an editor and I just use the right code in the xml file?

You'll have to experiment with the wysiwyg. Generally you need to upload each image. If you have a fixed number of images that doesn't change you may be able to setup the CMS to have a pulldown of images that the user can select. There's no support for image galleries where you can select previously uploaded images though.

>Is there a way to handle the auto thumbnail filed and larger picture
>field with cmsbuilder so again, the client doesn't see any code but the
>end result is the correct xml format like my example above? Possibly a
>redundant question. Just seems a little different to auto create a thumb
>while uploading, then somehow filling in the xml node with it. In other
>words, they would probably upload bigPicture, and a thumb would be
>created and the link would be the picture (thumb) node. By the way, i
>am using flash to do all the positioning, so none of those options should
>be available to the client in the editor.

Yes, CMS Bulder can automatically create up to 5 thumbnails of different sizes for your uploaded images (usually you'd just use 1).

The best way to get started is to install CMS Builder and start experimenting creating different types of sections.

Hope that helps.
Dave Edis - Senior Developer
interactivetools.com

Re: [rez] xml output

By rez - October 28, 2008 - edited: October 28, 2008

<?php foreach ($record['image'] as $upload): ?>
<image><?php echo $upload['urlPath'] ?></image>
<?php endforeach ?>



Got it. I understand that the outer homexmlRecords "foreach" loop runs through each record to display. I just don't know what's stopping the inner url loop from displaying all the images for every homexmlRecord. for each is new in AS3 and I wouldn't know how the nesting works either.

So here it says:

for each homexmlRecord, display stuff // displays the stuff for all records verticly

For each image record, display a <url> // this says to loop through and display all image urls, how is it only firing 1 for each time through the outer loop?



That loses me. And what's saying that it already displayed url 1, and should now display 2? Seems like from looking at the code, it would do this:

Show stuff 1

show all image urls

Show stuff 2

show all image urls again.

Thanks for the help. Now on to making <mylinks> show up.

Re: [rez] xml output

By rez - October 29, 2008 - edited: October 29, 2008

Still can't get

<?xml version="1.0" encoding="UTF-8"?>
At the top of my xml files. Any ideas?

Re: [rez] xml output

By Dave - October 30, 2008

Hi Rez,

Some older versions of PHP see anything in <? as code to be run, even <?xml ...

Try this little trick:

<<?php ?>?xml version="1.0" encoding="utf-8"?>

The empty PHP tag does nothing but breaks up the < and ? so PHP won't think the <?xml is something it needs to parse.

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] xml output

By rez - October 30, 2008

Works great. I wouldn't have ever known that, ha.

Question though, IE7 doesn't seem consistent in showing xml with that statement at the top or not. I have some files showing as an xml tree as expected, and some are looking like html. The file extention being php or xml has no effect either.

I know that's not a direct CMSB question but it's going to matter when using CMSB to feed pages for Flash, SEO, and mobile phones all at once.... sort of. Anyway, any idea what that's about?

Re: [rez] xml output

By Dave - October 30, 2008 - edited: October 30, 2008

The best strategy is to just use a feed or XML validator to check your feed. IE sometimes goes on the file extension rather than the header that is sent - against internet standards. Every other app we've seen that takes XML works fine as long as you send the XML header.

I'd give it a try and see if it works as is. If not, post the url to your dynamic PHP xml file and your text XML file that you know works and we can compare them.
Dave Edis - Senior Developer
interactivetools.com