Welcome Guest, Not a member yet? Register   Sign In
GET Variables and Helpers
#1

[eluser]Unknown[/eluser]
Hello,

I am new to CodeIgniter and just stmbled upon the post variables. I knowe they are filtered due to security reasons but isn't it quite unhandy to access them by their position inside the url? Do I have any option to access them as key => value pairs? This question just came up as I saw the introductory tutorials. What if my controler moves somewhere else, e.g. somewhere "deeper"? Or is it impossible due to the strict structure?
Another thing is the helper naming policy. Why aren't they classes? I mean, I have to create an artificial namespace anyway by prepending some prefix to their functions, so why not using static class methods instead?
Anyway I will keep on getting someway deeper into CodeIgniter since it has some neat features.

p.s. a newbie category inside the forum could be useful for people posting newbie stuff like me Wink
#2

[eluser]ejangi[/eluser]
Hi sgalonska - welcome to the forums! If you're creating your own helpers, you probably could use static class methods. I think the reason CI doesn't is because they're trying to maintain backwards compatibility with PHP4 (which doesn't do static class methods). I understand what you mean though and in fact, I wish PHP would do the same thing (array_ functions anyone???) Tongue

I too would like to see a method something like $this->input->post_as_array(); maybe you could put a post in the feature-requests forums?

As for the URI structures and the clearing of GET, there are a couple of methods in the URI class which might help, such as $this->uri->uri_to_assoc(); or even $this->uri->segment_array(); but keep in mind that the way CI is built, if it doesn't have something you need, you can very quickly extend it!




Theme © iAndrew 2016 - Forum software by © MyBB