"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/
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@syndicat.com> 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...
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/
participants (2)
-
Jaroslav Lukesh -
Niels Dettenbach