What is the difference between using the dtml-tree tag in a dtml method and using it in a dtml document? I have code that works perfectly in a dtml method but when I try the exact same code in a dtml document it doesn't display anything. Is it because the document is at the top of the namespace stack instead of the request object in the dtml document case, but not in the dtml method case? My branches method is a zsqlmethod that acquires its parameter from the namespace. Here's the code, if that helps: <dtml-var standard_html_header> <dtml-tree branches=select_subprojects id=project_id> <small><a href="edit_project?project_id=&dtml-project_id;">edit</a></small> <a href="view_project?project_id=&dtml-project_id;"><dtml-var project_name></a> </td> <td align=right valign=top><dtml-var task_count> </dtml-tree> <dtml-var standard_html_footer> select_subprojects is a zsqlmethod, the fields are project_id, project_name, and task_count. It takes one parameter, project_id which it acquires from the result set of the previous call to itself. I'm stumped. I could just use a dtml method instead of a document but I want to understand this. Thanks, --jfarr
Jonothan Farr wrote:
Is it because the document is at the top of the namespace stack instead of the request object in the dtml document case, but not in the dtml method case?
Hurm, thinking for the right words and I think(?) namespace is the right one. Anyway, DTML documents have one and DTML methods don't. Hence your tree tag is using the DTML documents namespace, which has nothing in it apart from the properties of the document. A method will use the namespace of the folder containing it, which will have all the other objects in that folder in its namespace. The vocab. I've used might not be quite right (someone please correct me :-) but the basic principal is what's going on. HTH, Chris
Jonothan Farr wrote:
Is it because the document is at the top of the namespace stack instead of the request object in the dtml document case, but not in the dtml method case?
Hurm, thinking for the right words and I think(?) namespace is the right one.
Anyway, DTML documents have one and DTML methods don't.
Hence your tree tag is using the DTML documents namespace, which has nothing in it apart from the properties of the document.
I don't think that's entirely accurate. There's a lot more in the namespace of a DTML document. I think you're right, though, in that it's a namespace issue. I found that the results of the SQL query where not part of the namespace in the DTML Document case, but they were in the DTML Method case. Here's how I got it working: <dtml-var standard_html_header> <dtml-tree branches_expr="select_subprojects(project_id=REQUEST.get('project_id',0) id=project_id> <dtml-call "REQUEST.set('project_id', project_id)"> <small><a href="edit_project?project_id=&dtml-project_id;">edit</a></small> <a href="view_project?project_id=&dtml-project_id;"><dtml-var project_name></a> </td> <td align=right valign=top><dtml-var task_count> </dtml-tree> <dtml-var standard_html_footer> In other words, I have to explicitly get the parameter from the result object and pass it back into the sql query. What I'd like to know is why? Is this a bug or a feature? Thanks, --jfarr
participants (2)
-
Chris Withers -
Jonothan Farr