nuxeo-localizer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nuxeo-localizer] rendering DTML through LocalContent


From: Luistxo Fernandez
Subject: [Nuxeo-localizer] rendering DTML through LocalContent
Date: Mon, 28 Oct 2002 09:49:26 +0100

Maybe this is anathema... But I took the idea from this tip at Zopelabs:
http://www.zopelabs.com/cookbook/1011691879/1011691351

This lets you produce DTML through LocalContent objects.

1. Create a Python Script and call it 'getdtml'.

2. Put this in the parameter list: myString2 = 'whatever'

3. The script´s code:

-----
from Products.PythonScripts.standard import DTML

request = container.REQUEST
RESPONSE =  request.RESPONSE

myString = myString2
myDTML = DTML(myString)
return myDTML(context, request, RESPONSE)
-----

4. Then create a default_template DTML method like this (or a similar one):

<dtml-var standard_html_header>
<h1><dtml-var title></h1>
<dtml-var getdtml(body)>
<dtml-var standard_html_footer>

5. There you have it: content you put at the 'body' fields of the LocalContent 
objects will be rendered as DTML.

---------

It also works with MessageCatalogs.
For instance,

a. Let´s create a MessageCatalog named 'MethodCatalog' with two languages: 'es' 
and 'en'.

b. In a given method or document, for instance in index_html, type as follows:

<dtml-var "getdtml(MethodCatalog('language_header'))">

c. In the MethodCatalog, search for the string 'language_header' and fill it as 
you like, for instance:

es: <dtml-var standard_html_header>
en: <dtml-var html_header_with_less_options>

---
It works!

Luistxo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]