[eluser]ivanhalen[/eluser]
[quote author="jamiejonks" date="1329422846"]If you have a page at index.php/news with links on it to
news/slugname, as you will if you follow the news tutorial, you end up with links in the form of
index.php/news/news/slugname, i.e. with two 'news' parts. Using the site_url() function or not typing 'news' into the href solves this, so the route given in the tutorial ($route['news/(:any)'] = 'news/view/$1'
works. I can't see how this modification is me 'not linking to the proper place', but rather that the tutorial contains an error.
Thanks for clarifying what the slug is, it's a shame the tutorial doesn't tell you not to put spaces in when manually creating a few records. Having said that, I'm sure at some point it would still be useful to know how to handle spaces (and anything 'unusual') in URLs. I haven't found a definitive 'best practice' answer to this.[/quote]
I just couldn't say better :-)
Yes, following the tutorial as-it-is leads to double "news" part in the url (
index.php/news/news/slugname), that is a real pain for novices trying to approach MVC and wondering "where am I wrong? Am I so bad in PHP that I can't follow the most basic tutorial?"... (and yes, the "site_url" stuff solves the problem... and yes, I banged my head too, before realizing I wasn't the problem)
CI is well known for its documentation, among the other advantages: please, CI Masters, don't let users run away from this wonderful framework back to procedural programming just because the introducing tutorial could be written better! Fix it ASAP! Thanks