• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Value from $this->uri->segment(1);

#1
[eluser]Subey[/eluser]
Hello

I need get value from www.somedomain.com/value.

My route:

$route['default_controller'] = "go";
$route['scaffolding_trigger'] = "";
$route[':num/:any'] = "go/index/$1";


in controller go.php:

function index($value){
$value = $this->uri->segment(1);
echo $value;

}

What i can do it??

#2
[eluser]Subey[/eluser]
anybody help ?? :|

Ok solved:

route:

$route['default_controller'] = "go";
$route['scaffolding_trigger'] = "";
$route[':any'] = "go";

controller:

function index()
{

$action = $this->uri->segment(1);
}

But i have new problem. When i want open controller: www.domain.com/welcome_controller
i must use: $route['welcome_controller'] = "welcome_controller";
Second problem www.domain.com/welcome_controller - work, www.domain.com/welcome_controller/login - (segment "login" don't work)

So if i want add new controllers i must add new lines in route.php.
Do you know better solution for this??


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.