Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

"dynamic" dtml-with from string content

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


nd at syndicat

Feb 17, 2012, 5:17 AM

Post #1 of 3 (436 views)
Permalink
"dynamic" dtml-with from string content

Dear all,


has somebody an idea here?:

I try to define a property "my_class_path" (string) on a folder and want to
use that within a dtml-with statement - i.e.:

my_class_path is i.e. "folder1.folder_sub"

<dtml-with "folder1.folder_sub">

seems to work, but i cant find any easy way to to use the content of the
string my_class_path within the with statement.

If i just have a single folder to get aquisition from, i just can use
something like:

<dtml-with "_[my_class_path]">

but if i have deeper pathes in my_class_path the this doesnt work.

I just can do directly:

<dtml-with "_['folder1']['folder_sub']">

but i can't just put "_['folder1']['folder_sub']" into my_class_path too -
this didn't works too...


It seems i have some tomatoes on my eyes. Can anyone push me back on the track
here?

Many thanks in advance...



best regards,

Niels.
--
---
Niels Dettenbach
Syndicat IT&Internet
http://www.syndicat.com/
Attachments: signature.asc (0.82 KB)


lukesh at seznam

Feb 17, 2012, 6:15 AM

Post #2 of 3 (419 views)
Permalink
Re: "dynamic" dtml-with from string content [In reply to]

varx = 'this is the text"
<dtml-var "_['varx']"> = <dtml-var varx> = 'this is the text"

varxx = 'varxy'
<dtml-var "_[varxy]"> = <dtml-var varx> = 'this is the text"

my_class_path is i.e. "folder1.folder_sub"

so:

<dtml-with "_[_.string.split(my_class_path, '.')[0]]">
<dtml-with "_[_.string.split(my_class_path, '.')[1]]">
......your code
</dtml-with>
</dtml-with>

Some tips:

<dtml-var "restrictedTraverse(_.string.join(VirtualRootPhysicalPath,'/') +
'/path/to/your/document',None).title">

google: dieter chap3 zope


----- Puvodní zpráva -----
Od: "Niels Dettenbach" <nd [at] syndicat>

I try to define a property "my_class_path" (string) on a folder and want to
use that within a dtml-with statement - i.e.:

my_class_path is i.e. "folder1.folder_sub"

<dtml-with "folder1.folder_sub">

seems to work, but i cant find any easy way to to use the content of the
string my_class_path within the with statement.

If i just have a single folder to get aquisition from, i just can use
something like:

<dtml-with "_[my_class_path]">

but if i have deeper pathes in my_class_path the this doesnt work.

I just can do directly:

<dtml-with "_['folder1']['folder_sub']">

but i can't just put "_['folder1']['folder_sub']" into my_class_path too -
this didn't works too...


_______________________________________________
Zope maillist - Zope [at] zope
https://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )


nd at syndicat

Feb 17, 2012, 6:41 AM

Post #3 of 3 (414 views)
Permalink
Re: "dynamic" dtml-with from string content [In reply to]

Am Freitag, 17. Februar 2012, 15:15:23 schrieben Sie:
> varx = 'this is the text"
> <dtml-var "_['varx']"> = <dtml-var varx> = 'this is the text"
>
> varxx = 'varxy'
> <dtml-var "_[varxy]"> = <dtml-var varx> = 'this is the text"
>
> my_class_path is i.e. "folder1.folder_sub"
>
> so:
>
> <dtml-with "_[_.string.split(my_class_path, '.')[0]]">
> <dtml-with "_[_.string.split(my_class_path, '.')[1]]">
> ......your code
> </dtml-with>
> </dtml-with>

This is very nice too - thanx! ;)

best regards,


Niels.


--
---
Niels Dettenbach
Syndicat IT&Internet
http://www.syndicat.com/
Attachments: signature.asc (0.82 KB)

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.