• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I build URL's like this ({title}-{id})?

#1
[eluser]Carmichael[/eluser]
Is there a CI function built that receives the id from the URL or do I have to create one by my self?

http://site.com/blog/welcome-to-my-blog-194/

#2
[eluser]Aken[/eluser]
A specific function just for that? No. But you can use routes to separate it, or just pick apart the URI segment.

#3
[eluser]Carmichael[/eluser]
Can you give me a exemaple?

#4
[eluser]InsiteFX[/eluser]
application/config/routes.php
Code:
$route['blog/welcome-to-my-blog/(:any:)] = 'blog/welcome-to-my-blog/$1';

http://site.com/blog/welcome-to-my-blog/194

#5
[eluser]Carmichael[/eluser]
[quote author="InsiteFX" date="1341619093"]application/config/routes.php
Code:
$route['blog/welcome-to-my-blog/(:any:)] = 'blog/welcome-to-my-blog/$1';

http://site.com/blog/welcome-to-my-blog/194
[/quote]
I want a - between the title and the id.
Like http://blog.se/welcome-to-my-blog-1

That's not possible?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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