Avoiding recursive container parsing
 
    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:

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 href and name attributes with its own values. The handler is called by the Caudium parser in response to, for instance, the below HTML code:

<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>

 
HTML OK CSS