You could do it, but you'd need some Javascipt to create the expand/collapse buttons, and (probably) some XSL to convert the XML into HTML.
Non-JS alternatives would involve some messy backend stuff with query strings... (and heck, if you're using client-side XSL transformations, getting hold of the query string is like getting hold of the holy grail [but it is possible])
PHP doesn't have to be present in the end user's system, it's server-side. But like I said, it will be messy witout Javascript...
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
Yes you would really have learn XSL & JavaScript. javascript could give you best results.
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
Yes, there is, you can do it all with server side scripting, or alternatively, make lots of files that represent every potential state that your tree can be in.
You could even do it with
Server Parsed XML, but you'd still need a way of maintaining state (possibly a session cookie, or a huge dynamic key that is generated by a server side script and affects the XML file returned by a page request at each click).
If you only want one area (node) of the tree to be expanded at a time, then I suppose it's easier, but it still requires a bit of href logic on your part when writing or generating the pages.
Why not show the tree expanded, and if Javascript is running on the computer, use it to collapse all of the unwanted nodes? That way, users who don't use JavaScript will have alot to read, and user's with JavaScript will only have a slight advantage.
I don't like using Javascript for anything that represents a "core" functionality.
EDIT: I should add, relying on client side XSL transformations is worse than relying on JavaScript! IF you are using XSL, look at the Xalan application ( www.apache.org ) if you want to generate pages one-time on your computer; or the PHP XSLT module if your pages might change frequently.
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64