RE: reference one container from another

"Marc Cardle" <[email protected]>
Newsgroups gmane.comp.cms.jahia.template
Message-ID <[email protected]>
Hi Chris,


You could store expression language markers in the fields of your container
so that they access field data from other containers. 

A marker is very similar to an HTML tag, it is an enclosure for a string,
that tells Jahia that it is not handling a regular string default value, but
rather that it must process the default value using certain sub-systems in
order to generate the values that will be displayed in the edition GUI
popup.

An Expression Language marker is a tiny script which is evaluated to
determine the default value of a field. It is compatible with Apache's Java
Expression Language (JEXL) specification. 

The syntax is as follows:

    <jahia-expression expr="user/username" storeMarker="false"/> (retrieves
the current username. If storeMarker was set to true, the expression would
not be resolved and  stored uninterpreted)

So to access a container, your expression would look something like this:

currentPage.containerLists["sourceContainer"].getContainerByID(1).fields["so
urceValue"].value

Basically this is the equivalent of the following Java code : 

currentPage.getContainerLists().get("sourceContainer").getContainerByID(1).g
etFields().get("sourceValue").getValue()

Note that EL markers are slower to execute. 

For more information, I suggest you refer to the "Content Reuse" chapter in
the Template developer guide
http://www.jahia.org/jahia/webdav/site/jahia_org/shared/documentation/templa
te/taglibdocv0.2.pdf

Hope this helps,

Marc


-----Original Message-----
From: chris markiewicz [mailto:[email protected]] 
Sent: 12 August 2005 17:06
To: [email protected]
Subject: reference one container from another

Is it possible to reference a value in one container from another container?
Or maybe there's another way to approach my problem.  Essentially I want to
have a "page-scope" container on a page - it will contain values that will
be used inside other containers.  How do I go about this?

thanks
chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.