What, if any, syntax permits me to put a dtml-call construct inside a hyperlink on a Web page? Right now, it seems to me that to execute a dtml-call, I have to create a DTML document which makes that call and then invoke the DTML document in the usual way in the link tag. This results in a bit of extra effort and extra files but I don't mind doing this if that's the most effective or efficient way. Conceptually, what I want (with the initial angle bracket removed to avoid formatting issues) is: a href="<dtml-call someDTMLMethodName>">link text </a> Now, I know that particular syntax won't work, but it shows what I believe I want. Or am I doing it the "best practices way"?
From: "Dan Shafer" <pydan@danshafer.com>
What, if any, syntax permits me to put a dtml-call construct inside a hyperlink on a Web page?
Not really, because that would be "passing a stream when fetching water". :-) DTML call is used to call functions from within DTML. Public functions are availiable directly from an url. Thusly: http://foo.bvar.com/path/object/method?param1=value¶m2=value
Conceptually, what I want (with the initial angle bracket removed to avoid formatting issues) is:
a href="<dtml-call someDTMLMethodName>">link text </a>
Yup. Remove both the brackets and the dtml-call bit and you are done! Not all methods are availiable like this, and only the methods that return HTML make any sense to use like this, but I'm sure you are ware of this.
[Dan Shafer]
What, if any, syntax permits me to put a dtml-call construct inside a hyperlink on a Web page?
Right now, it seems to me that to execute a dtml-call, I have to create a DTML document which makes that call and then invoke the DTML document in the usual way in the link tag. This results in a bit of extra effort and extra files but I don't mind doing this if that's the most effective or efficient way.
Conceptually, what I want (with the initial angle bracket removed to avoid formatting issues) is:
a href="<dtml-call someDTMLMethodName>">link text </a>
Now, I know that particular syntax won't work, but it shows what I believe I want.
Or am I doing it the "best practices way"?
You can get right to an object by traversal. For example, suppose you have a folder called "test", and a method in that folder called "theMethod". You can invoke it with this url: http://yourserver/test/theMethod You can use that in a link. If you include a query string, the method can access the request: http://yourserver/test/theMethod?xxx=yyy In the method, <dtml-var "REQUEST.xxx"> will render "yyy". Remember, though, if you do this you should really have the method return a complete html page with all the trimmings. In that case, there's not necessarily a big advantage in using a method rather than a document. Cheers, Tom P
participants (3)
-
Dan Shafer -
Lennart Regebro -
Thomas B. Passin