Cakephp Y U NO GET!?!?!?
Hello everyone, I am once agian running into a problem with something that's normally simple, yet lovely cakePHP has to make all so very hard.
I'm once agian tasked with improoving the bookmarking application on our website. This time I am suppose to have the url save the date: start & stop parameters within the url and use the url save mechanics of my bookmark tool. However cakephp isnt making this easy.
I tried using $this->request->query['action']; as well as $this->request['action']; even $this->params['action']; but none of this works. Any ideas on how to make this work using cakephp 2.3?
thanks!
Related Article: Sorting words into QWERTY order
is a solved PHP discussion thread by latooplat that has 10 replies, was last updated 9 months ago and has been tagged with the keywords: php, custom, sort, words.
soapyillusion
Junior Poster in Training
88 posts since Dec 2009
Reputation Points: 10
Solved Threads: 6
Skill Endorsements: 0
Ok so I was able to get url to pass to the controller using $this->params->query['param'] however, cakephp still tells me the variable is undefined, despite the fact I'm clearly printing it to the page... which is also preventing me from passing the variable to the view...
soapyillusion
Junior Poster in Training
88 posts since Dec 2009
Reputation Points: 10
Solved Threads: 6
Skill Endorsements: 0
I've been doing that and sadly once the focus is switched from the controller to the view the values set to those variables vannish. However the indexes in the array are allowed to stay....
Makes no sense to me O_O, I'm assuming it has to do with something set up in the config.php by the admin, but I honestly just don't know. (Never encountered this problem before with passing hardcoded variables or even ones transfered from an ajax call.
soapyillusion
Junior Poster in Training
88 posts since Dec 2009
Reputation Points: 10
Solved Threads: 6
Skill Endorsements: 0
Ok so after much struggle I was finally able to get the whole bookmark system to work. Keep mind this is normally would've of been a simple task. However I had an added handicap of using the jquery tabs too. So I feel its important I post how to do to this using it below.
First thing to note is when working with the tabs your url bar will not change from the outset. So the document.window function in javascript becomes all but useless for any page that uses it. Also note with Cakephp alot of built in encryption securty is used therefore any call make by ajax generally goes encrypted. Therefore making the use of a request_uri also very hard. You could use 'get' instead of 'post' but you will still run into problems pulling out the correct callback. (if you have a ton of callbacks going from a single event listener)
I came to the conclusion the best way to make this work is to "force" a url to be used that matches your specs. You can do this using session variables and the religous use of the app_controller. Add all your funcationality for the 'url reader' into the app_controller in your before filter this way, the url is read before the jgrid has the ability to troll with your url bar.
Now there is more to if that is if your using jqgrid but i suspect most people wont wanna go this far. If you wanna know more you can msg me asking me for help!
soapyillusion
Junior Poster in Training
88 posts since Dec 2009
Reputation Points: 10
Solved Threads: 6
Skill Endorsements: 0
Question Answered as of 4 Months Ago by
veedeoo