Hi–newbie EE questions here.
I want to access URL parameters in a template. This is a two part question I suppose:
1) I’ve learned that the $_GET supervar is munched by EE upstream, so using $_GET to retrieve a URL parameter is out (?), and I’ve also tried:
$this->EE->input->get('parameter_name');which also fails (returns FALSE) even though the parameter is present in URL…
So, is it possible to retrieve typical ‘?parameter_name=x’ parameters within a template?
2) I’m assuming that a better way to handle this is via a properly formatted friendly URL, ie:
/channel/template/parameter_name/value
but alas even though the EE docs allude to this capability, I am unable to find helpful instructions on how to configure such. Can somebody point me in the right direction on this?
Thanks!
Welcome to the forums, spaceageliving -
Have you seen the docs on URL segments? You should be able to simply pull in {segment_1}, {segment_2}, etc.
OK, great, thanks I hadn’t seen the page you recommend, very helpful.
So, I’ve “inherited” this code from a previous developer, and the url is formed like so:
/solutions/exceptional-donors/donor-database/donor-search-results/?sortby=donor_donors.donor_number&ℴ=descwhere ‘donor-search-results’ is referenced to the template in question.
If I want the two params to map to the {segment} vars, would this URL work:
/solutions/exceptional-donors/donor-database/donor-search-results/donor_donors.donor_number/descor alternatively:
/solutions/exceptional-donors/donor-database/donor-search-results/?donor_donors.donor_number/descThanks for your help!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.