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

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 18 2025 11:45:20
Script start
Timing: Jan 18 2025 11:45:20
Module start 'layout'
Timing: Jan 18 2025 11:45:20
Module start 'content'
Timing: Jan 18 2025 11:45:20
Module end 'content'
Timing: Jan 18 2025 11:45:20
Script end

Main resources:

Total runtime0.7811 sec
Peak memory usage4,096.0000 KB
Database Queries75

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 589.0234152.6250
Module start 'layout' 0.00680.0028 741.648439.4453
Module start 'content' 0.00960.7700 781.0938727.1172
Module end 'content' 0.77960.0015 1,508.210920.1641
Script end 0.7810  1,528.3750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00610.7802160.0004
Check MTime0.00130.1667160.0001
Mysql Total
Database connection0.00140.182710.0014
Mysqli_queries0.693088.7194750.0092
Looping result0.00090.1096730.0000
Template Total0.748895.920.3744
Template load0.00991.264320.0049
Template processing0.738994.594720.3694
Template load and register function0.00010.012710.0001
states
state_id_array0.00100.129110.0010
state_identifier_array0.00090.110520.0004
Override
Cache load0.00490.6267550.0001
Sytem overhead
Fetch class attribute can translate value0.00060.072350.0001
Fetch class attribute name0.00170.2204110.0002
XML
Image XML parsing0.00280.363250.0006
class_abstraction
Instantiating content class attribute0.00000.0038130.0000
General
dbfile0.00110.1381360.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 38
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs