Welcome Guest, Not a member yet? Register   Sign In
Tutorial error...?? (RESOLVED)
#12

[eluser]jamiejonks[/eluser]
I have just encountered a similar problem. Shame these comments can’t be shown underneath the tutorial rather than hidden away in a forum. Anyway, this is what I found:

1) The view (views/news/index.php) should contain a simpler href – just the PHP bit without ’news/‘ at the beginning.

2) if when creating the database records you used spaces in your slug field, you’ll get the 404 error from your new controller. I thought the purpose of the slug field was for a subheading to the news article, so of course my examples did contain spaces. The solution was to first encode the slug in the view (views/news/index.php):
Code:
<p>a href="&lt;?php echo rawurlencode($news_item['slug']) ?&gt;">View article</a></p>
(Actually, that step isn’t strictly necessary because the browser will do it automatically, but it makes the final HTML follow the spec)
NB I’ve left the opening angle bracket off the a tag here, because the forum wouldn’t let me include links in my post.

Then, in the news controller, add the line
Code:
$slug = rawurldecode($slug);
or similar to the view() function (method). It will now work.

I don’t know if this is the best way to do it.


Messages In This Thread
Tutorial error...?? (RESOLVED) - by El Forum - 01-23-2012, 05:03 PM
Tutorial error...?? (RESOLVED) - by El Forum - 01-23-2012, 07:41 PM
Tutorial error...?? (RESOLVED) - by El Forum - 01-24-2012, 09:56 AM
Tutorial error...?? (RESOLVED) - by El Forum - 01-24-2012, 05:26 PM
Tutorial error...?? (RESOLVED) - by El Forum - 01-24-2012, 10:14 PM
Tutorial error...?? (RESOLVED) - by El Forum - 01-25-2012, 02:02 AM
Tutorial error...?? (RESOLVED) - by El Forum - 01-25-2012, 02:03 AM
Tutorial error...?? (RESOLVED) - by El Forum - 01-30-2012, 08:04 PM
Tutorial error...?? (RESOLVED) - by El Forum - 01-31-2012, 01:20 PM
Tutorial error...?? (RESOLVED) - by El Forum - 02-09-2012, 04:57 AM
Tutorial error...?? (RESOLVED) - by El Forum - 02-09-2012, 10:50 AM
Tutorial error...?? (RESOLVED) - by El Forum - 02-12-2012, 02:44 PM
Tutorial error...?? (RESOLVED) - by El Forum - 02-12-2012, 07:08 PM
Tutorial error...?? (RESOLVED) - by El Forum - 02-12-2012, 08:41 PM
Tutorial error...?? (RESOLVED) - by El Forum - 02-16-2012, 01:07 PM
Tutorial error...?? (RESOLVED) - by El Forum - 02-16-2012, 03:25 PM
Tutorial error...?? (RESOLVED) - by El Forum - 03-04-2012, 09:42 PM
Tutorial error...?? (RESOLVED) - by El Forum - 07-18-2012, 09:13 AM
Tutorial error...?? (RESOLVED) - by El Forum - 08-22-2012, 03:18 AM
Tutorial error...?? (RESOLVED) - by El Forum - 08-22-2012, 03:24 AM
Tutorial error...?? (RESOLVED) - by El Forum - 10-16-2012, 01:28 PM
Tutorial error...?? (RESOLVED) - by El Forum - 02-03-2013, 02:25 AM
Tutorial error...?? (RESOLVED) - by El Forum - 02-04-2013, 11:35 AM
Tutorial error...?? (RESOLVED) - by El Forum - 08-26-2014, 08:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB