Thank you all very much for your answers.
The second solution that Jo provided worked exactly as I wanted:

.. tal:content="python: getattr(obj, 'Title_%s'%lang)"..

A good day to you all,

On 7/29/05, Jonathan <[EMAIL PROTECTED]> wrote:
I don't know if this is what you are looking for, but can use a form of indirection that is available thru dtml:
<dtml-call "REQUEST.set('a1', 'aaa')">
<dtml-call "REQUEST.set('b1', 'a1')">
<dtml-var b1>
<dtml-var "_[b1]">
will print:
This will allow you to load variable b1 within a 'pointer' to a variable containing the data you want.
----- Original Message -----
Sent: Friday, July 29, 2005 12:02 PM
Subject: Re: [Zope] Composing variables

Hello Andreas and thank for your answer. I've posted this question to at-users
list too but still no answer. In fact this problem is not related only to AT. Let me
give you an example:

var alternative = 'bar' or 'baz'
var foo_baz = 'content based on baz'
var foo_bar = 'content based on bar'

These can be defined either in ZPT, DTML or Python Script. The problem is the same.
The question is how can I obtain the value of foo_$alternative.

An example written in PHP:

$alternative  = "bar";
$foo_bar = "content based on bar";
echo ${"foo_".$alternative}

This will produce "content based on bar".

Thanks for your time,

On 7/28/05, Andreas Jung <[EMAIL PROTECTED]> wrote:

--On 28. Juli 2005 11:59:09 +0300 Cristi Barladeanu <[EMAIL PROTECTED]>

> Good day everyone
> I've defined some archetypes that contain fields like Title_en, Title_de,
> Content_en, Content_de, etc.
> Assuming that I've set a language var related to URL like (lang = 'en'),
> how  can i access them?

Please ask AT related questions on the at-users list. In general you should
not access attributes in AT directly but only through the accessor methods.
There is something like getField(fieldname) in the AT which might help you
(look also at the AT docs).


Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to