3

I'm writing project in CI and I have winamp plugin that pass values to CI thru URL (e.g. http://localhost/class/method/value1/value2/value3/... ) I have to pass 7 values but last 3 of them sometimes will be empty (e.g. http://localhost/class/method/value1/value2/value3/value4///value7 ) but that way value7 in CI assign as value5, and that's not what I want.

My question : Is there solution without adding extra symbol in winamp plugin like x:value7 and then removing x: and get only value itself.

4
  • 2
    You can still use regular query strings. If you're calling it from a Winamp plugin, it'd be better to use keys and values than making sure your arguments are always in order, anyways. Commented Feb 20, 2011 at 19:57
  • Is there way to enable query strings JUST for one or more controllers ? Commented Feb 20, 2011 at 20:06
  • 1
    yes...just rebuild the $_GET array by doing this: parse_str($_SERVER['QUERY_STRING'], $_GET);. Just be sure to run it through the XSS filter if you plan on putting any of that info back out to the user. Commented Feb 20, 2011 at 21:25
  • Found even better solution: http://localhost/controller/method/?field=value&field=value then in controller $field = $this->input->get('field'); Commented Mar 7, 2011 at 21:01

1 Answer 1

3

If one of the values is empty mark it as empty, null, or 0 based on that this value represent:

localhost/class/method/value1/value2/empty/value4/empty/value6/value7

make sure that method will react correctly on "empty"

Sign up to request clarification or add additional context in comments.

1 Comment

For those who want to know how i fix it: if (data.IsEmpty()) data = "%5F"; %5F is actually _ and in CodeIgniter if($this->data == '_') $this->data = NULL;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.