![]() |
An alternative way to send variables to functions? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: An alternative way to send variables to functions? (/showthread.php?tid=7222) Pages:
1
2
|
An alternative way to send variables to functions? - El Forum - 03-30-2008 [eluser]Pascal Kriete[/eluser] Uhhh.... $this->load->controller doesn't exist. I have no idea what you're trying to do. Can you give a more concrete example, doesn't have to be CI at all. Just a general idea of what you're trying to accomplish and why it needs query strings instead of slashed variables. An alternative way to send variables to functions? - El Forum - 03-30-2008 [eluser]adamp1[/eluser] Code: $this->load->controller("news",$array); what's that? that's not a valid CodeIgniter method. Hooks? there for performing actions before running part of the CodeIgniter system. An alternative way to send variables to functions? - El Forum - 03-30-2008 [eluser]Jamie Rumbelow[/eluser] Whatever. I know what I mean in my head. I'l do an example tommorow. EDIT: Right i've worked it out. Use the $this->load->vars() function in your constructor. An alternative way to send variables to functions? - El Forum - 03-30-2008 [eluser]adamp1[/eluser] @KeyStroke: Why are you worrying about it being a bit messy? Many many websites use very long url's to pass data. I know I never look at the url apart from the domain name (to check its not a scam). Other than how we said there isn't another way I'm afraid. An alternative way to send variables to functions? - El Forum - 03-30-2008 [eluser]KeyStroke[/eluser] Ok thanks. I guess I'll have to use it then. ![]() An alternative way to send variables to functions? - El Forum - 04-06-2008 [eluser]Lima[/eluser] Yeah it's possible for you just do this things : modify config/config.php Code: $config['permitted_uri_chars'] = ''; make helpers to easy access like this Code: if (! function_exists('get_request_data')) from your controller just call helper http://www.yoursite.com/welcome/home/?var1=value1&var2=value2 Code: $data = get_request_data(array('var1', 'var2', 'var3'), array('default1', 'default2', 'default3')); hope this can help. An alternative way to send variables to functions? - El Forum - 04-06-2008 [eluser]James Pax[/eluser] use post... so you can have a clean and sexy url ![]() An alternative way to send variables to functions? - El Forum - 04-06-2008 [eluser]adamp1[/eluser] Problem is if he's not using a form (which by the format he's looking at I would think he isn't) POST isn't an option. Uri_to_assoc is the best option. An alternative way to send variables to functions? - El Forum - 04-07-2008 [eluser]Lima[/eluser] I think so, uri_to_assoc() is the best option. But sometime when we submit form using GET method browser will generate query string like that. We need to convert query string to CI url style using JavaScript, but sometime some browser does not support JavaScript like elink. and the best way we must using POST method to request to server and redirect it to CI style url. Sometime I hate using POST method, because when browser need to be refreshed using F5 it prompt dialog box. My script just another option. ![]() An alternative way to send variables to functions? - El Forum - 04-10-2008 [eluser]ScottBruin[/eluser] Late to this party but Keystroke, I suggest using the "alternative to GET" helper function which allows URLS like example.com/folder/controller/method/name:joe/id:36043. It looks better than /name/joe/id/36043 and would make more sense to a user. http://codeigniter.com/wiki/alternative_to_GET/ |