Friday 10 February 2006 3:15:51 am
Hi, I am presented with an interesting problem. I have 2 classes: the first (class A) contains an XML block and some other fields, the second one (class B) has a file attribute and some other fields. users can insert eznode links into the XML field of class A , which will get translated via link.tpl to the <a href ....> link. The desired behavior is :
- links to nodes of classes other than B should work normally - links to nodes of class B should start the download of the file contained into the file attribute of class B. So far, I have patched this by creating an override tpl for class B which , via JS, redirects to the download of the file. but users are left with a blank page underneath and need to press "back" to return to the site. Not nice. Another solution would be to generate the link based on what kind of class is the node I am pointing to.
By browsing kernel/classes/datatypes/ezxmltext/handlers/output/ezhtmlxmloutput.php and link.tpl for ezxml link tags I can see that no parameters are passed to the tpl which could help e.g. node or object id. so I'd need a kernel hack to pass this value too. Another solution could be to intercept the output of link.tpl and reparse it to check if the pointed node is in the folder for objects of class B, but then I have the uncertain task of trying to find a node based on parsing an URL. Any ideas? TIA Max
|