Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-03 19:41:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Use join_qs with zero values

Passing a ‘0’ (zero) as an array $value 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

#2 2007-12-03 20:23:59

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#3 2007-12-04 09:49:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

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

Board footer

Powered by FluxBB