Welcome Guest, Not a member yet? Register   Sign In
Do I need to add a URI reroute for every single function for every single class?
#1

[eluser]iamsen47[/eluser]
Just wondering.
Because if so, it seems like this is going to be a real chore when building a huge website.

This is my current routes.
Code:
$route['tickets/index/(:any)'] = 'tickets/index/$1';
$route['tickets/(:any)'] = 'tickets/view/$1';
$route['tickets'] = 'tickets';
$route['create'] = 'create';
$route['login'] = 'login';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';
#2

[eluser]Migranux[/eluser]
Hello,
No, you don't Wink
Code:
$route['tickets/index/(:any)'] = 'tickets/index/$1';
$route['tickets/(:any)'] = 'tickets/view/$1';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';
Hope it will help you...
#3

[eluser]CroNiX[/eluser]
routing
Quote:Important: The reserved routes must come before any wildcard or regular expression routes.
#4

[eluser]iamsen47[/eluser]
[quote author="Migranux" date="1346355044"]Hello,
No, you don't Wink
Code:
$route['tickets/index/(:any)'] = 'tickets/index/$1';
$route['tickets/(:any)'] = 'tickets/view/$1';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';
Hope it will help you...[/quote]

Thanks.

Doesn't that mean that the create and login pages will have to be placed in the view functionality?

===

I tried replacing my routes with the ones you provided and my links stopped working.
I have only one controller called tickets.php with the index, create and login functions all inside it. Could I be doing something wrong?
#5

[eluser]iamsen47[/eluser]
[quote author="CroNiX" date="1346356390"]routing
Quote:Important: The reserved routes must come before any wildcard or regular expression routes.
[/quote]

Thanks, I have read that but it's just a bunch of jargon to me...
#6

[eluser]iamsen47[/eluser]
Code:
class Tickets
     function index()
          $this->load->view('tickets/index');
     function create()
          $this->load->view('tickets/create');
     function login()
          $this->load->view('tickets/login');

Essentially this is what I have in my tickets.php controller with the earlier routing I posted up top.
After switching to Migranux's routing, none of the links work anymore.

Have I misunderstood something somewhere?

baseurl/class/function/otherstuff

therefore

baseurl/tickets/index
baseurl/tickets/create
baseurl/tickets/login

Am I correct?

My config.php's base_url is just 'http://localhost/cidir/' and index_page is left blank.
Could these be the reason why the links stopped working?




Theme © iAndrew 2016 - Forum software by © MyBB