Forums / Setup & design / Flash, XML layout, cache...

Flash, XML layout, cache...

Author Message

Andreas Kaiser

Thursday 16 October 2008 3:52:42 am

Hello,

I usually use flash files/banners that reads content from a xml file.

To use ezp publish to change that content I use a xml layout (create overrides, configure templates, etc)

For example I have a flash banner that uses images and text. In ezp I've created an object flash_image inside the folder flash_banner...

When I create a new flash_image in this folder or change any of them the xml file "/layout/set/xml/content/view/full/421" is not changed, except I go to the specific url... Then the xml is loaded with the new image...

Is there any way to reload these xml pages with a cronjob or using some template code, config in siteaccess, etc

Thanks...

eZ Partner in Madrid (Spain)
Web: http://www.atela.net/

Piotrek Karaś

Thursday 16 October 2008 10:42:28 am

Hi,
Not sure if I understand correctly, but I think basic (not even smart) viewcache rules should take care of that. I usually choose another, yet similar approach, simply create new mode, so for a flash clip that is in the full mode:

/content/view/full/123

I would pass 123 as flash variable, and then have flash to query:

/content/view/flashxml/123

that for that mode I have an empty pagelayout override. Cache works fine there.
If you provide more detail or clear it up, maybe we can think of something.
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

André R.

Friday 17 October 2008 2:21:56 am

I'm also not entirely sure what Andreas does, I guess he does all the fetching in the xml pagelayout, thus trowing away the result of the module (in this case content/view) aka $module.result.content and not taking advantage of content view cache.

To further improve Piotrek's way to do things:
prepend layout/set/blankxml/ or something to the url, and define it in layout.ini as:

[blankxml]
PageLayout=
ContentType=text/xml

So no pagelayout is executed at all, meaning the template system is not loaded if the content/view is cached..

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Friday 17 October 2008 7:41:35 am

So no pagelayout is executed at all, meaning the template system is not loaded if the content/view is cached..

Nice!

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Andreas Kaiser

Sunday 19 October 2008 4:13:54 pm

I use a pagelayout_xml.tpl with just the line: {$module_result.content} and in layout.ini.append.php:

[xml]
ContentType=text/xml
PageLayout=xml_pagelayout.tpl
UseAccessPass=false

For a specific xml output I use a template override for specific node with following code:

<?xml version="1.0" encoding="utf-8" ?>
{def $banners= fetch(content, list, hash(parent_node_id, $node.node_id ))}
<news>	
{foreach $banners as $banner}
  	<item picNews={$banner.data_map.image.content[flash_news].url|ezroot('double','full')} titleNews="{$banner.data_map.name.content|ezwash()}" infoNews="{$banner.data_map.intro.content|ezwash()}" linkNews={$banner.object.data_map.link.content.main_node.url_alias|ezurl()}></item>
{/foreach}
</news> 

I've made some test in a site that uses this templates/settings and all is working OK (even with all caches enabled).

Will check if the problem in the production site is related with the flash file (another file than the one I've tested), browser cache, or something else...

Anyway thanks for the comments, it's good to know how you make it in these cases...

eZ Partner in Madrid (Spain)
Web: http://www.atela.net/

Luc Chase

Tuesday 24 November 2009 7:43:39 am

FYI
if you're storing the whole xml content (including tags) as 'user editable' content in the CMS, don't use wash.

The Web Application Service Provider

Gaetano Giunta

Wednesday 25 November 2009 7:01:57 am

The icing on the cake to Andre and Piotrek comments: you can add a wildcard url redirect so that the long url

/layout/set/xml/content/view/xml/123

can be replaced by

/flashsource/123

As for the caching problems:

- your example fetches 1st level children. When editing a child his parent is always expired

- standard view cache rules apply when using this technique, except...

- for the fact that only the FULL view mode (plus sitemap and pdf) benefits of a view cache by default. To use view cache for XML view mode, add it to the CachedViewModes setting in site.ini

- if generation of your xml view takes a while and you want to have a glitchless flash experience, you might want to pre-generate it: either via PreViewCache or via a cronjob that fetches periodically your xml urls...

Principal Consultant International Business
Member of the Community Project Board