Welcome Guest, Not a member yet? Register   Sign In
CI links question
#1

[eluser]bogdan3l[/eluser]
Hello!

It is possible to make links with CI like wordpress(http://www.example.com/2010/03/17/my-post/)?

I don't like http://www.example.com/controller-name-o...e/my-post/...!

Could somebody help me? An example or something would be great!

Thank you
#2

[eluser]nelson.wells[/eluser]
Look into routing in the user guide. It lets you re-route a url to a controller/function/parameters. Once you've come up with a url scheme, it's fairly easy to construct routes to use the controllers/methods you want.

So if you wanted a scheme such as http://www.example.com/blog/april/cross-site-scripting, then your route could look like this.

$route['blog/(:any)/(:any)'] = "blog/get_post/$1/$2";

Where blog (at the right side of equals) would be the controller, get_post would be the method in the controller, and $1 and $2 would be parameters to the method in the controller.

You can use regex instead of simple strings to do more complex routing techniques, too.
#3

[eluser]bogdan3l[/eluser]
Thanks a lot for your reply, i will try right now.




Theme © iAndrew 2016 - Forum software by © MyBB