Okay, just want to post what i've learned so everyone else can have a ball with CMSMS and Flash.
Before we start i have to strech that i've just made this work for myself, i might have missed a step or two in my explanation but it should inspire you on how to make the news module print it's data as xml for flash
To make the news module print out as xml there's a few things we need to fix first.
01 - make our own news summary template
02 - setup ud a normal page for our xml data
03 - make a clean page template (nothing in it but xml content)
04 - remove some comments in a php file
05 - some Flash code
01.
first of, the news Summery template, goto content > news > (tab) summery templates
make a new template and past in this code, in short it runs through all the news entries and placing them within theire own category tags for easy access and sorting within flash.
Code: Select all
{assign var='tc' value=$items[0]->category}
<cat>
{foreach from=$items item=entry}
{if $entry->category eq $tc}
<postdate><![CDATA[{$entry->postdate|cms_date_format}]]></postdate>
<pageUrl><![CDATA[{$entry->moreurl}]]></pageUrl>
<title><![CDATA[{$entry->title|cms_escape}]]></title>
<catName><![CDATA[{$entry->category}]]></catName>
<auther><![CDATA[{$entry->author}]]></auther>
<summery><![CDATA[{eval var=$entry->summary}]]></summery>
<content><![CDATA[{eval var=$entry->content}]]></content>
<extra><![CDATA[{eval var=$entry->extra}]]></extra>
{else}
</cat>
<cat>
{assign var='tc' value=$entry->category}
<postdate><![CDATA[{$entry->postdate|cms_date_format}]]></postdate>
<pageUrl><![CDATA[{$entry->moreurl}]]></pageUrl>
<title><![CDATA[{$entry->title|cms_escape}]]></title>
<catName><![CDATA[{$entry->category}]]></catName>
<auther><![CDATA[{$entry->author}]]></auther>
<summery><![CDATA[{eval var=$entry->summary}]]></summery>
<content><![CDATA[{eval var=$entry->content}]]></content>
<extra><![CDATA[{eval var=$entry->extra}]]></extra>
{/if}
{/foreach}
</cat>
it's not pretty but it works
02.
let's create a new page which will output our xml formatted news elements.
goto content add new page where ever you like, call it whatever you like
before we write the code to view the news elements, then turn off the WYSIWYG, otherwise we'll might end up with a few html tags in our xml feed, now type this line.
{cms_module module='news' number='5' summarytemplate='NAME-OF-YOUR-NEWS-SUMMERY-TEMPLATE'}
(well im not sure about the number='5' if you get problem then mingle a bit with that hehe)
okay now you should be able to view the site, click on the page you created for news and you should see the html page plus all your news elements in one big mess
03.
Clean page template to remove all html code other than the xml news feed.
goto Layout > templates
Create a new template and type this in
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xmldata>
{content}
</xmldata>
this will create a tottaly blank page and and inserting whatever content we feed it through the pages's (our home made xml news feed), but to make this work we myst go back to our page in "content" and assign our new template to that page, revisit the page we created earlier goto to the options tab and change the tempate to what ever you named your template.
04
if you view your page live again you should see the news feed's only without any html stuff, try view source to make sure the data is all XML based data only.
well it's properly not, at the top and bottom you'll properly notice some commended text, to remove this we'll have to edit the PHP file which build the news feed, don't worry it's VERY simple.
hook up your FTP client and goto this folder:
/modules/news
download and open this file in ex. notepad
action.default.php
scroll down on the page till you find this:
Code: Select all
echo "<!-- Displaying News Module -->\n";
echo "<!-- News Categories: '".(isset($params['category'])?$params['category']:'')."' -->\n";
delete thoes two lines, save the file and upload and overwrite the php file in /modules/news
That's it
05.
i use this code in flash to load my XML file (AS2)
Code: Select all
function loadXML(success) {
if(success) {
txt.htmlText = unescape( this.childNodes[0].childNodes[6].childNodes );
}else{
trace("Error on loading the XML file");
}
}
_root.xmlData = new XML();
_root.xmlData.ignoreWhite = true;
_root.xmlData.onLoad = loadXML;
_root.xmlData.load("LINK-TO-PAGE-THAT-PRINTS-YOUR-XML-NEWSFEED");
to get the right link, just view the page in your browser, copy past the link in flash

(ps. in the AS code im outputting the xml data to a text object called "txt" )
I hope this would help anyone who's interessted in using CMSMS as a CMS for their flash projects.
Kind regards
Mads ny
www.madeofdots.com 