|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
boyer Smarty Rookie
Joined: 08 Apr 2009 Posts: 9
|
Posted: Wed Nov 24, 2010 5:09 am Post subject: Modifying $_GET |
|
|
Hey everyone!
I'm sure there's a simple way to accomplish what I'm looking to do here, and I'm just missing it...
Let's say I have a controller class that extends Smarty, and does all my work for me. At the end of the controllers work, it calls $this->display('myTemplate.tpl'); and we're off to the browser.
Let's say I've got an email inbox, and I've just made a GET request to delete message #999. I pass the parms like this: inbox.php?action=delete&messageId=999.
My controller does it's thing, deletes the message, gets the messages from the db, then displays them back to the user. The problem is, I still have "&action=delete&messageId=999" in the URL bar. If the user refreshes, they'll get an error message stating that message doesn't exist etc etc.
Is there any easy way in Smarty to remove those parameters from GET?
I've tried doing it directly in php before I call $this->display() by doing $_GET["action'] = "" or unset($_GET["action"]) or $_GET["action"] = null, but none of these things do what I need them to.
I really don't want to resort to doing all my actions via POST (means adding more javascript).
Thanks for the help! |
|
Back to top |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
Posted: Wed Nov 24, 2010 9:53 am Post subject: |
|
|
Have you tried to explode() the url with "?" and redirect to "new" URI ? |
|
Back to top |
|
boyer Smarty Rookie
Joined: 08 Apr 2009 Posts: 9
|
Posted: Wed Nov 24, 2010 5:36 pm Post subject: |
|
|
Well atcuall I already have some convenience methods written to take the get args I currently have, add/remove/modify them, then build out the new string that would be appended to the URI.
Trouble is, I need my template output to display. I don't want to redirect to another controller first.
Can you think of a usage example where at the end of my controller, but before I call $this->display() that I could implement this? |
|
Back to top |
|
douglassdavis Smarty Junkie
Joined: 21 Jan 2008 Posts: 541
|
|
Back to top |
|
creiglee Smarty n00b
Joined: 16 Jul 2015 Posts: 1
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|