In-Content Global Variables. Possible?

Author Message

Russell Michell

Monday 05 May 2008 9:32:34 pm

Hi folks,

We have a requirement to show the latest volcano status (A number) in the actual text of an Article content object for example, around the website. At the moment with Plone, we can only show this data on a single page.

What we'd like to do is something like this below. Note that I'm still an Ez Newbie, so my language/concepts may not be 100% accurate :-)

Create a custom form content-object
that stores the following somewhere: Volcano name (str). Volcano status (int) this is the central 'area' where this data is added/updated.

Be able to then reference the current status of a specific volcano, by placing some reference to a variable/notation in the bodytext of an Article so that when viewing an Article, the latest status for a given volcano is displayed. (Say Volcano1 = 3)

So if I edit any article and place this:

Volcano 1 Status: $volcano_status_1

somewhere in amongst the bodytext via the WYSIWYG editor, when I saved the article, "3" would show up.

Is something like this possible with Ez?

Many thanks for your time.

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.

André R.

Tuesday 06 May 2008 12:01:40 am

Yes, but you can't insert template variables directly, but you can create a custom tag (see doc online and content.ini in you settings folder) that generates this data for you and can be placed anywhere in the XML block content.

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

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 19 2025 00:20:03
Script start
Timing: Jan 19 2025 00:20:03
Module start 'layout'
Timing: Jan 19 2025 00:20:03
Module start 'content'
Timing: Jan 19 2025 00:20:04
Module end 'content'
Timing: Jan 19 2025 00:20:04
Script end

Main resources:

Total runtime0.8086 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.0391152.6406
Module start 'layout' 0.00500.0027 740.679739.4922
Module start 'content' 0.00770.7996 780.1719533.9297
Module end 'content' 0.80730.0013 1,314.101612.1406
Script end 0.8086  1,326.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4634160.0002
Check MTime0.00180.2224160.0001
Mysql Total
Database connection0.00070.087210.0007
Mysqli_queries0.758993.8560540.0141
Looping result0.00050.0670520.0000
Template Total0.771595.420.3858
Template load0.00230.282320.0011
Template processing0.769295.132020.3846
Template load and register function0.00010.013110.0001
states
state_id_array0.00090.105410.0009
state_identifier_array0.00080.096220.0004
Override
Cache load0.00190.2366180.0001
Sytem overhead
Fetch class attribute can translate value0.00110.134720.0005
Fetch class attribute name0.00170.211840.0004
XML
Image XML parsing0.00100.122520.0005
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00240.2956230.0001
String conversion0.00000.000940.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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/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: 12
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs