Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Migrating a Site to Silverstripe /

What you need to know when migrating your existing site to SilverStripe.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Incorporating Flash with Dynamic Content


Go to End
Reply


10 Posts   5442 Views

Avatar
Ctrl+Z

Community Member, 9 Posts

18 February 2009 at 9:11am

Hi, this is only loosely relating to silverstripe and is probably much more a flash issue, but I thought I may as well try out the silverstripe community and see how I go.

Well anyway, I have a flash banner/gallery type object on my website which I am migrating to my new silverstripe website. At the moment the images, text, and links are hard coded into the fla and I have to edit it by hand when I want to make changes. Could someone point me in the right direction on integrating this into my site so that it updates based on the latest content? Or so I can control it from within the CMS?

Obviously the first step is getting the flash to load an xml file and read the items. Anyone know how to do this in a straightforward way or have some links to tutorials?

All feedback appreciated - thanks

Avatar
Ingo

Forum Moderator, 801 Posts

24 February 2009 at 8:49pm

You can output XML from SilverStripe in various ways. One of the easiest is RestfulServer (http://doc.silverstripe.com/doku.php?id=restfulserver). It uses XMLDataFormatter, a utility class which might be helpful for you as well. And then there's the good old "make a new template with XML header" way ;) There's not much difference to creating an HTML template really. As for your banner, I'd suggest an image relation on your homepage in the CMS ($has_one Image), which you can then form into XML with a new controller method on Page.php

Avatar
RolfChen

Community Member, 6 Posts

16 May 2010 at 12:17am

Hi,

Is there any example of how this is done? or just a simple example of what an XML template looks like?

Avatar
banal

Community Member, 901 Posts

16 May 2010 at 4:42am

Hi. You can create a template for XML exactly the same way you would do for a regular HTML Page.
I suggest, you create a special method on your Controller that will output the XML Formatted Data.
Eg. in Page_Controller you would write:

function xml(){
   return array();
}

Then you create a template for this method. Name it: Page_xml.ss and fill it with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<page>
   <title>$Title.XML</title>
   <content><![CDATA[
   $Content
   ]]></content>
</page>

Now you should be able to access the XML Data, by appending xml to your URL. So if you have mysite.com/contact, you would use mysite.com/contact/xml in flash to access the XML Data.

This is a very basic example. You could also use $Layout in your XML Templates, or use the renderWith method to render some data with an "xml template". Although there are numerous ways to build a SilverStripe driven Flash site, the one outlined above is probably the easiest.

Avatar
RolfChen

Community Member, 6 Posts

16 May 2010 at 3:12pm

Hi Thanks, that was great!

Is there any extension out there that edits XML like row by row similar to a table view?

e.g.
<album>
<title>Meteora</title>
<title>Minutes to Midnight</title>
</album>

where I can allow the client to add in extra album titles? Because $content will do it in a big bulk right?

Avatar
bartvanirsel

Community Member, 94 Posts

17 May 2010 at 6:53am

you could use modeladmin, i recommend reading this: http://doc.silverstripe.org/modeladmin

Avatar
banal

Community Member, 901 Posts

17 May 2010 at 8:17am

Model-Admin is indeed a possibility. In most cases, the DataObjectManager Module is the best tool for tasks like this. It allows you to edit DataObjects right in the Content area of the CMS.

Avatar
biapar

Forum Moderator, 435 Posts

29 June 2010 at 7:22pm

There is an example on ssbit site, too.

Go to Top