Welcome Guest, Not a member yet? Register   Sign In
Time for URL's YAY!
#1

[eluser]Michael Nielsen[/eluser]
Hi, so I'm a newbie at PHP and CI, please bare with me.

It's it possible to have the following URL:

Code:
index.php/support/ticket/reply/758593

(758593 been the ticket ID)

or is it only possible to have 3 segments

Code:
index.php/ticket/reply/758593
#2

[eluser]xwero[/eluser]
You can have any number of segments
#3

[eluser]warrennz[/eluser]
Depending on what you want to do you can have as many segments as you want.

If you want to customize the URI segments differently to the standard /controller/method/var1/var2.. you'll need to define URI routing routes in config/routes.php

Assuming you have a controller called ticket, with a method called reply, that takes a variable (the id) you can add this to your URI routing file
Code:
$route['support/ticket/reply/:num'] = 'ticket/reply/$1';

:num means it will accept only numbers. If you tried to access site.com/index.php/support/ticket/reply/random_string CI would return an error or a 404 not found.

Read up on CI URI routing to get more familiar with replacements etc.

Smile
#4

[eluser]Phil Sturgeon[/eluser]
Making a guess here it looks like using a controller sub-directory might be what you are looking for.

Or possibly search for Matchbox for a more modular approach. Using Matchbox you could group all support controllers, models and views into one folder, instead of them all being split across your application.

Routes are a good option too.
#5

[eluser]Michael Nielsen[/eluser]
Thanks guys. Exactly what I was looking for!




Theme © iAndrew 2016 - Forum software by © MyBB