An alternative way to send variables to functions? |
[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.
[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.
[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.
[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.
[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/?va...ar2=value2 Code: $data = get_request_data(array('var1', 'var2', 'var3'), array('default1', 'default2', 'default3')); hope this can help.
[eluser]James Pax[/eluser]
use post... so you can have a clean and sexy url
[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.
[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.
[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/ |
Welcome Guest, Not a member yet? Register Sign In |