Concrete 5 to generate XML data from DB

Permalink
Hello,

Im trying to build a flash site which uses XML data as its data source and Im planning on using Concrete 5 for the CMS.

Is it possible for Concrete 5 to generate XML from the database and use that xml and feed it inside flash?

Thanks a bunch! and more power to C5!!!

 
jordanlev replied on at Permalink Reply
jordanlev
This is indeed possible, but not very straightforward. Search the forums for things like "flash xml" and "ajax request" -- the basic idea is that you create a package that contains a block which outputs the flash code and has an edit interface that saves the config data to the database. Then you have another file that you put in the tools directory of that package that generates xml by querying the database tables for the config data. Look at the RSS functionality of the built-in "page_list" block to see an example of how this XML is outputted.

One thing to note -- in order to pass the URL of this xml file to flash, you will want some code like this in your controller:
public function getContentXmlUrl($b){
if(!$b) return '';
$c = $b->getBlockCollectionObject();
$a = $b->getBlockAreaObject();
$qs = 'bID='.$b->getBlockID()
.'&cID='.$c->getCollectionID()
.'&arHandle='.$a->getAreaHandle();
$qs = urlencode($qs); //<--Do this otherwise flash chokes on the querystring.
$uh = Loader::helper('concrete/urls');
$url = $uh->getToolsURL("generatedxmlfilename/?$qs", 'packagename'); //<--the actual "generated xml" file needs to end in .php, but don't put the ".php" here.
return $url;
}


Then in your block's view, when you need to pass the url to the xml file to your flash (usually via flashvars or params), do this:
echo $controller->getContentXmlUrl($b);


Good luck!

-Jordan Lev