NAME
AxKit::XSP::QueryParam - Advanced parameter manipulation taglib
SYNOPSIS
Add the parm: namespace to your XSP <xsp:page
> tag:
<xsp:page
language="Perl"
xmlns:xsp="http://apache.org/xsp/core/v1"
xmlns:param="http://www.axkit.org/2002/XSP/QueryParam"
>
And add this taglib to AxKit (via httpd.conf or .htaccess):
AxAddXSPTaglib AxKit::XSP::QueryParam
DESCRIPTION
AxKit::XSP::QueryParam is a taglib built around the Apache::Request module that allows you to manipulate request parameters beyond simple getting of parameter values.
Tag Reference
<param:get name="foo" index="1"/
>
Get a value from the given parameter. The "name" attribute can be passed as a child element for programattic access to parameter values. If the index attribute is supplied, and if multiple parameters are supplied for the same "name", then the appropriate parameter is returned. If multiple values for the same parameter are given, but no index is supplied, the first value is returned. Now, if you can understand that convoluted set of instructions, then you're smarter than me!
<param:set name="foo" value="bar"/
>
Set a parameter value. You can use child elements for both "name" and "value". This is very useful when you want to override the parameters provided by the userr.
<param:remove name="foo"/
>
Remove a parameter. Surprisingly enough, you can use child elements here as well. Are you beginning to notice a pattern?
<param:exists name="foo"/
>
Returns a boolean value representing whether the named parameter exists, even if it has an empty or false value. You can use child...oh, nevermind, you get the idea.
<param:enumerate/
>
Returns an enumerated list of the parameter names present. Now, it hardly needs to be said, but unfortunately, it will be said anyway: This tag can take a name attribute (or, well, see above) supplying the name of the parameter you want to enumerate.
Why, you may ask, is this necessary? If multiple parameters are supplied that all have an identical name, this attribute will allow you to enumerate all the appropriate name/value pairs for that key name. It's output is something like the following:
<param-list>
<param id="1">
<name>foo</name>
<value>bar</name>
</param>
...
</param-list>
<param:count name="foo"/
>
Returns the number of parameters provided on the request. If a name is provided, the number of parameters supplied for the given name is returned. If the name is left out, then the total number of parameters is returned.
<param:if name="foo"
</param:if>>
Executes the code contained within the block if the named parameter's value is true. You can optionally supply the attribute "value" if you want to evaluate the value of a parameter against an exact string.
This tag, as well as all the other similar tags mentioned below can be changed to "unless" to perform the exact opposite (ala Perl's "unless"). All options must be supplied as attributes; child elements can not be used to supply these values.
<param:if-exists name="foo"
</param:if-exists>>
Executes the code contained within the block if the named parameter exists at all, regardless of it's value.
<param:if-regex name="foo" value="\w+"
</param:if-regex>>
Executes the code contained within the block if the named parameter matches the regular expression supplied in the "value" attribute. The "value" attribute is required.
AUTHOR
Michael A Nachbaur, mike@nachbaur.com
COPYRIGHT
Copyright (c) 2002-2004 Michael A Nachbaur. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.