parameter for default controller |
[eluser]aryan_[/eluser]
I have created a default controller 'Pages'. How do I pass parameter to index of this controller? i.e. http://example.com/param1/param2 I need this only for default controller. Please help. Thanks!
[eluser]Isern Palaus[/eluser]
[quote author="aryan_" date="1259077368"]I have created a default controller 'Pages'. How do I pass parameter to index of this controller? i.e. http://example.com/param1/param2 I need this only for default controller. Please help. Thanks![/quote] Hi, you can use: $param1 = $this->uri->segment(1); $param2 = $this->uri->segment(2); in your index() function. Wish it helps! Isern
[eluser]aryan_[/eluser]
Quote:you can use: But, It'll look for controller for segment1 and function for segment2! I've got a little success using route: $route['pages/:any'] = "pages/index/$1"; I can remove 'pages/' to achieve this, but what about other controllers?
[eluser]jedd[/eluser]
You are allowed, nay encouraged, to use the [url="/forums/search/"]search feature[/url] within the forums. This was posted and answered (probably for the umpteenth time) just ten days ago in the thread titled [url="/forums/viewthread/135187/"]Parameters to Controller index()[/url] (alarmingly close to parameter for default controller, eh?). |
Welcome Guest, Not a member yet? Register Sign In |