Q1. Q1 {A} -------------------------------------------------------- Is it possible to rewrite the following piece of DTML into something easier and managable? <dtml-if "_.string.split(URL,'/')[-1]=='foobar_html'"> Cool! You are viewing foobar_html <dtml-elif "_.string.split(URL,'/')[-1]=='barfoo_html'"> More cool! You are viewing barfoo_html <dtml-elif ... <dtml-elif ... </dtml-if> This is supposed to be in the standard_html_header, and I now wonder if it is possible to write an switch or case statement for this. Q1 {B} -------------------------------------------------------- How do you write an AND and OR in an IF-statement? I have tried this: <dtml-if "_.string.split(URL,'/')[-2]=='pornfolder' OR/AND _.string.split(URL,'/')[-2]=='murder_todolist_folder'"> You are viewing the pornfolder AND/OR the murder_todolist_folder!! </dtml-if> ...but that does not work. I would also like to use something like this: "...=='pornfolder' OR/AND 'murder_todolist_folder'" Ideas? Tips? Q2 -------------------------------------------------------- How do you change the source to the Attribution button in the standard_html_footer? Q3 -------------------------------------------------------- When I installed Zope on my NT I installed it as a service (i.e. that it autostarts). Now, for some reason it does not autostart; which is what I want. How do I fix that? If I reinstall Zope, will my installed products and objects (can be export-/imported) be deleted? Thank you for you advice ladies and gentlemen!
On Tue, 23 May 2000, peter wrote:
Q1 {A} -------------------------------------------------------- Is it possible to rewrite the following piece of DTML into something easier and managable? <dtml-if "_.string.split(URL,'/')[-1]=='foobar_html'"> Cool! You are viewing foobar_html <dtml-elif "_.string.split(URL,'/')[-1]=='barfoo_html'"> More cool! You are viewing barfoo_html <dtml-elif ... <dtml-elif ... </dtml-if>
This is supposed to be in the standard_html_header, and I now wonder if it is possible to write an switch or case statement for this.
Well (untested), <dtml-let greetings="{'foobar_html': 'Cool! You are viewing foobar_html', 'barfoo_html': 'More cool! You are viewing barfoo_html'}"> <dtml-var "greetings[_.string.split(URL,'/')[-1]]"> </dtml-let> might get you somewhere useful, depending on what it is you really want to do. (You might want 'dtml-try' code in case the last path element isn't in your array.) There isn't any dtml-case type statement.
Q1 {B} -------------------------------------------------------- How do you write an AND and OR in an IF-statement? I have tried this: <dtml-if "_.string.split(URL,'/')[-2]=='pornfolder' OR/AND _.string.split(URL,'/')[-2]=='murder_todolist_folder'"> You are viewing the pornfolder AND/OR the murder_todolist_folder!! </dtml-if> ...but that does not work.
What fails about it? I presume your 'AND/OR' means you have tried both keywords and had similar failures. The syntax is right as far as I can see, though of course the AND case could never evaluate to true in this specific example.
I would also like to use something like this: "...=='pornfolder' OR/AND 'murder_todolist_folder'"
The way to write this in python would be (untested): <dtml-if "_.string.split(URL,'/')[-2] in ('pornfolder','murder_todolist_folder')"> An AND case of this would be nonsensical. Your remaining questions I will leave to others. --RDM
participants (2)
-
peter -
R. David Murray