Wednesday 07 May 2008 6:17:18 am
Sorry, I have a hard time understanding your explanation, even though it is detailed - must be the translation. I assume the following about your setup:
- the treeview that has to be built via javascript is still part of the same, single eZ Publish site. - the javascript that builds the treeview is also hosted on the same ezpublish server, and is in fact used on a page served by eZ Publish
About the 2 methods you describe for having the existing js lib generate the treeview, I assume you mean:
1 - the html+js page that renders the treeview makes xhr calls to another url to fetch the xml that describes the node structure 2 - the html+js page that renders the treeview finds the xml string that describes the node structure inside itself, as a javascript var option 1 is more flexible, 2 is faster In any case, I do not think there is any need for an eZ Soap client here: ez soap client is a server-side component, completely unlike javascript. If you use it, you will have an eZ page making an http request to another eZ page, which is a complete waste of resources. The way I would implement the 2 options above are: 1 - as noted in the previous response: the js code in the first page makes an xhr request to a different eZPublish page. The second requested page is full xml. The js code parses the retrieved xml and injects data in the treeview. 2 - have the xml "printed" inside the page that renders the treeview: this is even simpler, as eZ, as you said, knows how to render the treemenu node in xml. Just add to your template of the first page code like this
<script type="text/javascript">
myJsString = '{node_view_gui content_node=172 view='xml'}';
windows.onload = myLib.rendertreefromxml(myJsString);
</script> For more docs on node_view_gui see http://ez.no/doc/ez_publish/technical_manual/4_0/reference/template_functions/visualization/node_view_gui
Final comment: "The JS is already developed and I cannot build JSON templates. Your explanation about the custom http request could be a guide, but if defined, is the JS going to "get" the XML code of the page. I mean ez will certainly get that code, but is JS going to do the same? If you could give us more information so we can carry on it will be appreciated indeed"
- ez does not "get" any xml code of pages. the browser gets the xml code, ez gets the browser request and sends back the xml - as I said above, js is going to get exactly the same that your browser gets (if it makes the same request). It then will or will not be able to make use of what it has gotten.
Principal Consultant International Business
Member of the Community Project Board
|