Flash and Joomla! integration (part II )
Hello,
due to popular demand :D, I'm posting a different example to ilustrate how easy is to export Joomla! content to a XML format and then use it inside your flash movies (as you learned in the first part of this "article"). Today I'm gonna show a quick-and-dirty way to export your frontpage items.
Before we start:
- Make sure you've read the first part (link is above) of the article otherwise you won't understand nothing that is posted here.
- You don't need to change anything in the XmlGenerator class. This script will just USE it.
- I'm sorry I'm not posting the .fla, I've gotta write my final project for college and didn't have enough time to code the actionscripts (any volunteer?)
Ok, here's a small script I've wrote to export frontpage items and then generate the xml.
-
<?php
-
/**
-
* Joomla! FrontPage - XML-Generator
-
* @author Matheus Mendes aka bigodines - http://www.joomla.com.br
-
* @date May, 2007
-
* @license GNU GPL v2.0
-
*
-
*/
-
-
// joomla stuff
-
include_once("../configuration.php");
-
include_once("../includes/database.php");
-
// XmlGenerator
-
include_once("clsXmlGen.php");
-
-
/* database object */
-
$database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
-
-
$database->setQuery("SELECT content_id id FROM #__content_frontpage");
-
$front_items = $database->loadObjectList();
-
-
foreach($front_items as $item) {
-
$database->setQuery("SELECT id, title, introtext, created FROM #__content WHERE id = {$item->id}");
-
$content = null;
-
$database->loadObject($content);
-
// filling the array
-
$source[$content->id]['title'] = $content->title;
-
$source[$content->id]['introtext'] = $content->introtext;
-
$source[$content->id]['link'] = $mosConfig_live_site . 'index.php?option=com_content&task=view&id='.$content->id.'&Itemid=2';
-
}
-
// array is ready. Next step: call the XmlGenerator to do its thing
-
$xml = new XmlGenerator("latestNews", $source );
-
-
?>
I hope it works
cheers,
bigo
13 Comments so far
Leave a reply

Thanks for the post. I’ll start workin on the action script & let you know how I got on.
Thx,
F.B.I
there was a parsing error on line 34 so I commented it out.
/*$source[$content->id][’link’] = $mosConfig_live_site . ‘index.php?option=com_content&task=view&id=’.$content->id’&Itemid=2′;*/
Not sure what this line is supposed to do, looks like it tries to call up itemid=2, though not sure. Appears to work with the line commented out just fine though.
I believe the action script would go something like this:
meuObjXML = new XML();
meuObjXML.load(”http://www.yoursite.com/xmlgen/xgen-frontPage.php”);
meuObjXML.ignoreWhite = true;
meuObjXML.onLoad = function ()
{
play ();
};
itemId=(item#);
I think this is right….
would you mind sending the .fla to: bigodines@no spam@joomla.com.br ?
well, I haven’t made a flash yet with it. Just created the docs on my server and tried them. I did pull of the script from your site and made a flash of it. Having trouble translating things to English though. I could send it to you for translation….
ok. send me
ok, sent it. Due to your flash being in Portuguese, some of the functions are in need of translation. I could tell what you achieved, see how you did it (although to recreate it from your language to English has proven a struggle), and am impressed with your skills in action script for not knowing it before the site was created. Good Job!
This is excellent! Thank you for creating this and helping the joomla community.
Can someone share a fla that loads the front page correctly? I can get the menu to work…but having difficulties with the front page.
could this be used or adapted to be used for any Joomla content, such as specific sections/categories. Would you be able to use this to import any/all Joomla content into a Flash text scroller for instance with the flash nav/menu itmes targeting the scroller instead of the Joomla URL - hence a full flash cms?
I develop Joomla/Drupal sites, and flash, but am not an expert programmer so feel free to give me a simplistic answer on this one.
I am looking to see if there is a way to integrate Joomla Community Builder Profiles, a HelpDesk system, and a FAQ system into Flash. In essence to build a one stop interface. But even if I could just start out with getting a handle on how to import Joomla content into flash, that would be a great start.
I am skilled in the visual end of flash end of things. I can pull out all the stars and banners if need be
So If you need a hand on at that end with this tutorial I could assist if you could teach some things on the integration/functionality end.
-Jen
Hi, I’ve tested your class, and it works excellent.
Just like Jen above, I’d love to see it integrated further with Community Builder. I’m looking forward to tested it further.
A question, though. How do you display the front end with only my own articles in it? I mean, after I’m logged in, I’d like to see my own articles appear on the front page (in flash mode).
Pitra, in this case you would need something to grab the user session. I’m now sure how to deal with php sessions in flash but, supose you are already logged in your joomla db (and the session is created) you could add the xmlGen into a component (using index2.php insetead of index.php so you have only the output generated by xmlGen) and use $my->id as a filter in your SQL.
This should do the trick.
I’m no Flash expert so I don’t know how you can manage the session in a 100% flash site. If you know, tell me
Wow, nice work people. There is not much I can see around for getting this working elsewhere. I would love to see an example or help on getting a html page from joomla being rendered in flash. Although flash is limited in the html support, you are still able to embed swfs, links and images.
Being able to have a html and flash site working side by side would be amazing.
Hi,
I’ve been trying to create the action script that will load the frontpage content but I can’t seem to get it to work, is there any update on the fla ? I would love to have a look at it and see how this works!
Sorry to bug you if you haven’t had time for it!