Best practice to create XML used by embedded Flash slideshow

Author Message

Paul Etienney

Monday 17 January 2011 2:57:47 am

Hello eZ riders,

My client needs to embed flash slideshows in his pages. The slideshow class is a container and each of its children is a slide. It uses XML to be generated.

I am looking for the lightest way to create this XML. I have two ideas :

The first one is to use a new pagelayout.

The second one is to create a new module, changing the header and using eZExecution::cleanExit(); at the end.

Which one is the best solution ? Do you have another idea ?

Thank you very much.

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Benjamin Choquet

Monday 17 January 2011 3:44:26 am

What about an ezjscore ajax server call ? I only used it once but it was pretty simple to make a little AJAX module and though I used a JSON response, I think you can require XML format.

Check out this tutorial

Paul Etienney

Monday 17 January 2011 3:47:42 am

Hello Benjamin,

Thank you for the suggestion. I keep it in mind. I would like to have other advices before choosing.

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Ronan Guilloux

Monday 17 January 2011 4:52:46 am

Hello Paul,

If your XML contents are not often updated, nor need to be always-up-to-date provided, I 'd suggest you to daily-generate your XML via a cronjob, using eZ PHP API + SimpleXML, & store it into a dedicated /var/storage/xml directory. That would be quicker to serve. Real time PHP-generated XML files hardly challenge Apache.

--
Ronan Guilloux

Gaetano Giunta

Monday 17 January 2011 5:26:33 am

For this very simple use case, you'll be better of using an xml view of your contents. No need to touch a single line of php code (I know some devs prefer to do php rather than templates, but well...)

- use the layout/set module to create an xml pagelayout, to be served with the correct MIME content-type header

- create an empty template that will be used for 'xml' view of any content

- test it works: layout/set/xml/content/view/xml/2

- override usage of /node/view/xml.tpl for your gallery class, showing for it listing of children

- to make sure the view cache is generated for the xml view, change the value of CachedViewModes in config file site.ini.append.php

- if the generated urls are bit too long for you, use a wildcard url rewrite rule

You can also download the ggxmlview extension from http://projects.ez.no/ggxmlview/ and use it as starting point

Last but not least, there are some template operators used for json-encoding and xml-encoding available in the ezjscore extension

PS: I think this has been answered in the forums half a dozen times already... ;-)

Principal Consultant International Business
Member of the Community Project Board

Paul Etienney

Wednesday 19 January 2011 3:05:08 am

Hello Gaetano,

Thank you for this very complete answer. I think I will use your solution.

Bye

PS : My question was more a "What is the best practice ?" than a "How to ... ?". Be sure that i look for answer before asking questions :)

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Gaetano Giunta

Wednesday 19 January 2011 6:14:32 am

Well, my word is the de-facto best practice, of course! ;-)

But since two different opinions had been given, I preferred to give detailed instructions on a different approach so that you would be able to compare and judge by yourself, rather than simply assert the merits of it...

Principal Consultant International Business
Member of the Community Project Board

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.