|
|
|
How to avoid recursive container parsing?
The problem
If you want to overload/redefine a standard HTML tag, which will most likely involve returning the same tag from your handler function back to the client, you must take measures to stop Caudium from parsing the returned tag and, thus, calling your handler function recursively. The best way to do it is to return an one-element array(string) containing the result. A short example: array(string) tag_a(string tag_name, mapping args, string contents, object id, mapping defines) { mapping new_args = ([]); // add some args new_args->href = "http://caudium.net"; new_args->name = "caudium_site"; // create the output - a new container - and return it // to the parser that called us. return ({ make_container(tag_name, new_args, contents) }); }
The above example, as you can see, redefines the HTML <a> tag by adding (or replacing)
the <a title="this is my title">Title</a> The result of the above code will be as shown below (HTML code again): <a title="this is my title" href="http://caudium.net" name="caudium_site">Title</a> |
|
Copyright © 2000 - 2005
The Caudium Group
All Rights Reserved. Hosting by Kazar.
|
|