Menu

#8 $sess->new_query() required

open
nobody
None
5
2001-08-18
2001-08-18
No

Regarding add-query(), the docs say: Intended usage is
like this:

<a href="<<?
$sess->pself_url().$sess->padd_query(array("again"=>"yes"))
?>"> Reload</a> and log in?

The way it works is that if there is an existing value
in QUERY_STRING, add_query() expects self_url() to have
already ouput it. So it uses & as the sepchar and adds
the extra vars onto the end.

If add_query() is called after purl() and with a value
in QUERY_STRING, add_query() assumes QUERY_STRING has
been output, so uses & as sepchar. In fact purl() won't
have output the QUERY_STRING therefore ? would be the
correct spechar, so add_query() does the wrong thing.

There needs to be a series of methods that allow query
strings to be added to arbitrary URLs. I suggest
methods called new_query() and pnew_query(). Usage
would be:

<a href="<?
$sess->purl("another_page.php").$sess->pnew_query(array("param"=>"val"))
?>">another page</a>

These would function just like add_query() except they
would assume QUERY_STRING had not been output.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.