Tutorial error...?? (RESOLVED) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Tutorial error...?? (RESOLVED) (/showthread.php?tid=48641) |
Tutorial error...?? (RESOLVED) - El Forum - 10-16-2012 [eluser]CMG Dev[/eluser] Same problem here. Tutorial should be fixed. Other way is confusing. Tutorial error...?? (RESOLVED) - El Forum - 02-03-2013 [eluser]Unknown[/eluser] Thanks Peter for being the first to come up with the right answer. What I found though is that you really only have to change one line. Inside the controller in the view function change $data['news'] to $data['news_item']. Code: <?php This makes sense semantically because the view function in the controller is meant to retrieve only one "news_item." The "news/view" view then still only displays one "news_item" and the "news/index" view displays a collection of "news_items". Tutorial error...?? (RESOLVED) - El Forum - 02-04-2013 [eluser]Aken[/eluser] If you continue reading the tutorial page, the view() method is revamped with additional logic and the correct updated code. Tutorial error...?? (RESOLVED) - El Forum - 08-26-2014 [eluser]Unknown[/eluser] [quote author="Aken" date="1327372880"]What's the URL of the page giving you the 404 error? You can use example.com instead of your live domain. A couple things you can try: 1) Load the URL helper to your controller constructor, and use the site_url() function to help generate the news slug URL. Code: // In News __construct(): 2) In your controller's view() method, replace show_404() with something like Code: exit('The error is here.'); This worked perfect, thank you very much! |