Forums / Developer / Best practice to create XML used by embedded Flash slideshow

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

eZ debug

Timing: Jan 29 2025 13:41:51
Script start
Timing: Jan 29 2025 13:41:51
Module start 'content'
Timing: Jan 29 2025 13:41:51
Module end 'content'
Timing: Jan 29 2025 13:41:51
Script end

Main resources:

Total runtime0.1643 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0072 588.1875180.8047
Module start 'content' 0.00720.0127 768.9922101.9922
Module end 'content' 0.02000.1443 870.9844530.2813
Script end 0.1643  1,401.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00382.3167200.0002
Check MTime0.00150.9132200.0001
Mysql Total
Database connection0.00140.823410.0014
Mysqli_queries0.106464.73711410.0008
Looping result0.00110.67761390.0000
Template Total0.143787.410.1437
Template load0.00090.564910.0009
Template processing0.142786.860910.1427
Override
Cache load0.00060.382810.0006
Sytem overhead
Fetch class attribute can translate value0.00090.525810.0009
XML
Image XML parsing0.00030.165610.0003
General
dbfile0.00835.0317200.0004
String conversion0.00000.003230.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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