Hi guys! I would appreciate some help here:
What I want to do:
remove &itemsperpage=10 from:
http://localhost/thi/search/filter.html?type=featured&page=2&itemsperpage=10
and create a link from it:
http://localhost/thi/search/filter.html?type=featured&page=2&itemsperpage=15
here's what I have come up with so far:
<a href="<?php echo url::site(url::current()) . http_build_query($_GET) // don't know what follows ?>"
the framework functions I'm using are:
url::current() = returns current url in controller/action format
url::site() = returns absolute url i.e http://localhost/site/controller/action
so I have to remove '&itemsperpage' from the resulting string in the http_build_query function
but I am having trouble with character encodings and such! please help!
so here's the problem with character encoding:
$needle = '&itemsperpage';
$querystring = http_build_query($_GET) . '<br/>';
// echo $querystring . '<br/>';
$pos = strpos($querystring, $needle);
$remove = substr($querystring, ((int)$pos));
echo substr(str_replace($remove, '', $querystring), 1); // returns ';'
I can't remove the string '&itemsperpage' from the result of http_build_query which is: 'type=featured&page=2&itemsperpage=10' and functions like strstr outputs nothing