Some questions for experienced zopers
I've got two pressing questions that I can't seem to find answers to on zope.org: 1. What is the relationship that dtml has (if any) to javascript? Specifically, I want to do onmouseover swapping of a .gif. It seems to me that it would be simple with dtml, something like <dtml-if img1 mouseover == true> <dtml-var img2> <dtml-else> <dtml-var img1> </dtml-if> but I can't find a reference to any such functions. Otherwise, what is the best way to integrate js and dtml? (Sorry for any syntax errors, I'm just starting out) 2. I would like to aggregate my images into a common folder off the zope root, something like this: (indenting to show directory structure) / Mysite [_] control_panel [_] acl_users [_] images * img1 * img2 * img3 % index_html % standard_error_message % standard_html_header % standard_html_footer and then call them as <dtml-var images/img1> in index_html. Even though the documentation suggests that this is possible, doing so always returns an error for me. any help? Thanks, VanL
I've got two pressing questions that I can't seem to find answers to on zope.org:
1. What is the relationship that dtml has (if any) to javascript? Specifically, I want to do onmouseover swapping of a .gif. It seems to me that it would be simple with dtml, something like <dtml-if img1 mouseover == true> <dtml-var img2> <dtml-else> <dtml-var img1> </dtml-if>
but I can't find a reference to any such functions. Otherwise, what is the best way to integrate js and dtml? (Sorry for any syntax errors, I'm just starting out)
Nothing readymade I'm afraid, but; The image object supports a tag() method: Usage: <dtml-var "img1.tag(height=1,width=1,alt='Hello')"> Any other key:value arguments while be written as key:values inside the img-tag. <dtml-var "img1.tag(onClick='callClcFunc();')"> or <dtml-var "img1.tag(onClick=alert(\'Hello world\');')"> Notice that you must escape the ' inside strings. I hope this helps you? Best regards, Johan Carlsson
2. I would like to aggregate my images into a common folder off the zope root, something like this: (indenting to show directory structure) / Mysite [_] control_panel [_] acl_users [_] images * img1 * img2 * img3 % index_html % standard_error_message % standard_html_header % standard_html_footer
and then call them as <dtml-var images/img1> in index_html. Even though the documentation suggests that this is possible, doing so always returns an error for me. any help?
You have to keep in mid your working with a server-side Object Databas. Something are quite different to a filesystem based webserver. First, there's two ways to access those images: 1. Modifying the namespace (namespace (and aqusition) is really really confusing in the begining, but its the goodstuff that make Zope shine in the end.) If your position is in the root folder (http://server/index_html for instance) You can change your namespace (temporarly) to the "images" folder, you do this with the dtml-with tag: <dtml-with "images"> # the namespace inside here is that of the images folder <dtml-var "img1.tag(your js-stuff and more")> </dtml-with> 2. Object Referense: If you only need to "fetch" one item (img1) from the images folder you could use the following syntax: <dtml-var "images.img1.tag(do ya thang)"> At this point your probably preaty mad at me for showing you the "hard" way in 1. Well it's to get you to understand namespaces, I myself had some trouble with that in the beging... ;-) Good luck, Johan Carlsson
Is it possible to create custom tags with Zope? For example: Say I would like to create a newsbox using tables, something that, when processed, would return something like this: <table BORDER=0 CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH="100%" BGCOLOR="<--user defined color 1-->"> <tr> <td> <table BORDER=0 CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH="100%" BGCOLOR="<--user defined color 2-->"> <tr> <td> <STRONG><--user defined headline--></STRONG><br> Some content </td> </tr> </table> </td> </tr> </table> I'd like to be able to do this by writing something like <dtml-newsbox red,white,"This is the headline"> Some content </dtml-newsbox> Even more ideal would be some method that provided a nice forms interface, like the one for dtml methods, but with the special fields: Outside Color: [_______________________] Inside Color: [_______________________] Headline: [__________________________________] Text: [------------------------------] | Some content | | | [___________________________________] Is this possible? Any ideas/links on how to do it? Thanks, VanL
Hi Van - It is generally not a good idea to create a new tag for too specialized applications although it is certainly possible. I believe Andrew Kuchling wrote a guide once.
Say I would like to create a newsbox using tables, something that, when processed, would return something like this:
Is not a DTML Document not enough to do what you need? I suppose you could use a ZClass and define the choice form too if you want to get fancier. Pavlos
Pavlos Christoforou wrote:
Hi Van -
It is generally not a good idea to create a new tag for too specialized applications although it is certainly possible. I believe Andrew Kuchling wrote a guide once.
[snip]
Is not a DTML Document not enough to do what you need? I suppose you could use a ZClass and define the choice form too if you want to get fancier.
The thing is, I'm designing an application where I won't be adding the content, or even directly controlling the layout myself; rather, I need to have a nice forms-based interface where someone who doesn't know html can use a set of building blocks to design custom sites. So maybe it might not be a good idea in general, but it is exactly what I need here. In a larger sense, I want to design a set of dtml methods and documents that can then be used to generate a set of dtml methods and documents. I think that should be possible. Last, how do you create a ZClass? Any links or help? If anyone wants to know more in detail what I'm doing, just email me. Thanks, VanL
On Mon, 18 Oct 1999, Van Lindberg wrote:
Is it possible to create custom tags with Zope? For example:
Yes. In lib/python/products have a look at MIMETools and MailHost. A more minimal example can be found if you download the Logger product from Zope.org.
Even more ideal would be some method that provided a nice forms interface, like the one for dtml methods, but with the special fields:
You want ZClasses for this - See http://www.zope.org/Documentation/Guides/ZDG for a tutorial on building ZClasses. What you are trying to do is no more complex than the example it walks you through. ___ // Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au // E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au //__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen
participants (5)
-
Johan Carlsson -
kayak -
Pavlos Christoforou -
Stuart 'Zen' Bishop -
Van Lindberg