• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter custom route and parameters passed via url.

Hello guys,
I have a problem with parameter passed to controller function:

PHP Code:

class App extends CI_Controller {

    public function 
__construct() {



    public function 
login($status) {

$message 'You have to login first in order to access member area.';

$data = array(

'alert' => TRUE,
'class' => 'alert-danger',
'message' => $message






Now in routes.php I have following:

PHP Code:
$route['login'] = 'app/login';
$route['login/(:any)] = 'app/login/$1'; 

The problem is that when I will visit 'app/login/err_not_allowed' the $data array is filled properly with values but when i visit 'login/err_not_allowed' the array is empty and i get error that variable doesn't exist and is undefined.

Your missing the closing quote on the last route.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

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