Aruments added to URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rob0514
Forum Newbie
Posts: 1
Joined: Wed Jun 17, 2009 9:11 am

Aruments added to URL

Post by rob0514 »

This is an issue in Drupal 5. I've posted in the Drupal forum and haven't received any solutions. This feels like a sessions issue but only occurs on specific pages of the website. Any insight would be greatly appreciated. Thank you

When using table sort or pager the arguments become part of the url for example--

"leelanaunews.com/drupal/?q=view/classified_list&sort=asc&order=Expiration+Date" Becomes

"leelanaunews.com/drupal/?q=view/classified_list%26sort%3Dasc%26order%3DExpiration%2BDate&sort=desc&order=Expiration+Date"

And then grows expotentialy every time I click on a new link.

For a live example visit http://leelanaunews.com/drupal/?q=view/classified_list and play around with sort and pager.

Thanks
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: Aruments added to URL

Post by mattpointblank »

Have a look at the output of the $_SERVER array - some of the items in there can be used to supply the URL to your script, minus the arguments, so you could change the Drupal code to use this, rather than (as it seems to be doing) using the entire URL to append arguments to.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Aruments added to URL

Post by McInfo »

Here is a simulation of what appears to be happening.

Code: Select all

<?php
header('Content-Type: text/plain');
 
// Simulates $_SERVER['QUERY_STRING']
$qs = '?q=view/classified_list&sort=asc&order=Expiration+Date';
 
// Collects everything after the first forward-slash
$extra = substr($qs, strpos($qs, '/') + 1);
 
// Puts the query string back together with $extra encoded
echo '?q=view/'.urlencode($extra); // The $_GET variables are appended after this
?>
Edit: This post was recovered from search engine cache.
Post Reply