nuxeo-localizer
[Top][All Lists]
Advanced

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

Re: [Nuxeo-localizer] rendering DTML through LocalContent


From: Juan David Ibáñez Palomar
Subject: Re: [Nuxeo-localizer] rendering DTML through LocalContent
Date: Mon, 28 Oct 2002 11:21:13 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020913 Debian/1.1-1

Actually, some users asked me how to interpret LocalContent
data as DTML. This is the best solution for them, I didn't
knew about it. Maybe it's time to add this to your list of
Localizer tips :-)


Regards,



Luistxo Fernandez wrote:

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


_______________________________________________
Nuxeo-localizer mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/nuxeo-localizer




--
J. David Ibáñez, http://www.j-david.net
Software Engineer / Ingénieur Logiciel / Ingeniero de Software






reply via email to

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