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.

eZ debug

Timing: Jan 29 2025 14:44:39
Script start
Timing: Jan 29 2025 14:44:39
Module start 'layout'
Timing: Jan 29 2025 14:44:39
Module start 'content'
Timing: Jan 29 2025 14:44:39
Module end 'content'
Timing: Jan 29 2025 14:44:39
Script end

Main resources:

Total runtime0.0126 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0039 588.3906151.2422
Module start 'layout' 0.00390.0019 739.632836.7188
Module start 'content' 0.00580.0054 776.351698.2344
Module end 'content' 0.01130.0013 874.585941.9766
Script end 0.0126  916.5625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002016.1646140.0001
Check MTime0.00107.6999140.0001
Mysql Total
Database connection0.00065.161010.0006
Mysqli_queries0.002015.992430.0007
Looping result0.00000.064410.0000
Template Total0.00107.610.0010
Template load0.00086.242110.0008
Template processing0.00021.327210.0002
Override
Cache load0.00064.541910.0006
General
dbfile0.001713.746980.0002
String conversion0.00000.032240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs