Minor problem, but I'm wondering if there's a better URL plugin.

I'm using the URL plugin for column headings -- click on the column
heading to sort by that column.  Click again to reverse the sort
order.

I only want to include the "reverse" parameter in the URL when it's
set to true.  But, I can't see any way with the URL plugin to remove
it.


I initialize the URL object with any existing parameters from the
previous request:

    USE u = URL( myself, request.parameters );

Then for each column I add (or replace) the existing "sort_order" parameter
for the current column, and set the "reverse" parameter, if needed.

    FOR column = column_names;
        IF column = request.parameters.order;
            SET reverse = request.parameters.reverse ? 0 : 1;
            SET href = u( sort_order = column, reverse = reverse );
        ELSE;
            SET href = u( sort_order = column, reverse = undef );
        END;
    END;

But then I end up with URLs that have ?order=title&reverse=&foo=123

Anyone have a better Plugin floating around?

-- 
Bill Moseley
[EMAIL PROTECTED]


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to