Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Use join_qs with zero values
Passing a ‘0’ (zero) as an array $v
alue to join_qs() results in the parameter not being added to the query string, since if ($v)
returns false. Is join_qs() supposed to behave this way, i.e. is it designed only for non-zero values? If so, I’ll look elsewhere for a way of adding ?foo=0
to the qs.
Just trying to use TXP’s native functionality wherever possible now I’m getting a handle on what some of it does!
Last edited by Bloke (2007-12-03 19:42:11)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Use join_qs with zero values
It’s intentional, I think. join_qs() is only used by pagelinkurl().
One of the parameters in the array fed to join_qs is the page number. When the page number is ‘0’, the pg parameter should be omitted from the pagelinkurl, that’s why join_qs behaves as it does.
It’s difficult to estimate how changing that behaviour would affect other parts of TXP and plugins, so I doubt this will be changed in 4.0.x. Probably best not to use this function for your own plugins.
Offline
Re: Use join_qs with zero values
ruud wrote:
It’s intentional, I think. join_qs() is only used by pagelinkurl(). Probably best not to use this function for your own plugins.
Fair enough, makes sense. Thanks for the answer Ruud, I’ll steer clear.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Pages: 1