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 - 01-23-2012 [eluser]Matteo[/eluser] From a new CI user... I was following the tutorials and got the first part of the news page to work, but when I click on the "slug" entry to go to the second single-post page, I get CI's 404 error. My model code is as follows: Code: <?php Code: <?php foreach ($news as $news_item): ?> Code: <?php Code: <?php Code: */ Tutorial error...?? (RESOLVED) - El Forum - 01-23-2012 [eluser]Aken[/eluser] 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.'); Tutorial error...?? (RESOLVED) - El Forum - 01-24-2012 [eluser]Matteo[/eluser] The URI of the page is Code: http://domain.com/index.php/news/slugname if that helps... I will try your suggestions and let you know, thnx. +++++++++++++++++ I just made the changes to my code that you suggest and I still get the same internal CI 404 error when I try to view Code: http://domain.com/index.php/news/slugname Help! I'm tearing my fingernails out! Tutorial error...?? (RESOLVED) - El Forum - 01-24-2012 [eluser]Aken[/eluser] Whoops, sorry. The URL for viewing a news article the way you have it set up now would be: Code: domain.com/index.php/news/view/slug If you want to use the URL structure with "news/slug", then you need to add a route: Code: $route['news/(:any)'] = 'news/view/$1'; Tutorial error...?? (RESOLVED) - El Forum - 01-24-2012 [eluser]Matteo[/eluser] The route was already there. I gave up and re-did the entire tutorial from the beginning. It is still borked. Code: http://www.domain.com/index.php/news Tutorial error...?? (RESOLVED) - El Forum - 01-25-2012 [eluser]Aken[/eluser] A blank page means there is an error somewhere, but you have error reporting turned off. The CI tutorials out there are incredibly simple. Maybe you should learn more about PHP before trying to use CodeIgniter. Tutorial error...?? (RESOLVED) - El Forum - 01-25-2012 [eluser]Aken[/eluser] In your routes, define your default controller and error controller rules before anything else. Tutorial error...?? (RESOLVED) - El Forum - 01-30-2012 [eluser]Unknown[/eluser] What fixed the issue? I ran into the same thing. Tutorial error...?? (RESOLVED) - El Forum - 01-31-2012 [eluser]Benair[/eluser] I was trying to work through the Tutorial and ran into the same issue and ended up resolving it in my example. After a lot of head-banging and trial and error, I discovered this was an issue in my own setup. I didn't know what the "Slug" represented so I typed in "Sample Slug 1:", etc... I changed the text that I had put in the sample records in the Slug field and got it working. If you put more than one word in the slug it breaks on the spaces (because it uses the slug for the filename in the URL) also if you put a colon( in the slug it breaks etc. so maybe this will help others to resolve it. I've worked with Procedural PHP for a long time at my job having to fumble along and learn as I go, so admittedly I dont understand objects and frameworks and I'm trying to get up to speed... The codeigniter tutorial seems well laid out and informative and I know MVC gets lots of praise but I have to say that the general framework/MVC approach sure seems to be very (very) confusing to me. I hope the light comes on soon because I'm just guessing at how this all works????? Tutorial error...?? (RESOLVED) - El Forum - 02-09-2012 [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.'); That's resolves! |