Can't finish tutorial. |
I tried to pass a Codeigniter tutorial at http://www.codeigniter.com/user_guide/tu...ction.html
seems I did all step by step from the guide, but I met 2 problems. When I filled some stuff to data base, and created 2 news manually, and tried to click "View article" , it sends me to index.php/1st and shows me 404 error . By tinkering around I found that article actually exist, but it has different adress /index.php/news/1st. But I don't know why it's broken and how to fix it. Is tutorial guide old and out-of-date, or I failed? Also same problem with the http://www.codeigniter.com/user_guide/tu...items.html when I finished it, I can't add news through web-form. It sends me to 404 page with ridiculous adress. Ty for attention.
Actually you have one error only.
Your "first" error is not an error, that is how codeigniter urs works, see http://www.codeigniter.com/user_guide/general/urls.html For your "second" error check your form_open try changing it to PHP Code: <?php echo form_open('http://ci.local/index.php/news/create') ?>
(04-19-2015, 01:34 PM)weaboo Wrote: I tried to pass a Codeigniter tutorial at http://www.codeigniter.com/user_guide/tu...ction.html Try going into your application/config/config.php file and setting your $config['base_url']= 'your_base_url' and your $config['index_page']=' ' <---------- take index.php out so the value is empty.
I just did the tutorial and there is a slight error in the views/news/index.php file. In the anchor tag on line 9 it should be like this:
<p><a href="<?php echo 'news/'.$news_item['slug'] ?>">View article</a></p> instead of: <p><a href="<?php echo $news_item['slug'] ?>">View article</a></p>
It was changed, because in our case it worked in opposite way: Userguide CI 3.0 error.
(04-20-2015, 12:04 AM)Muzikant Wrote: It was changed, because in our case it worked in opposite way: Userguide CI 3.0 error. Edited... I ate my words. Upon further inspection, I now understand the problem. You are routing the first segment to (:any) for the static pages and then overriding that setting with the $config['news'] = 'news' That is a bit confusing for a introductory tutorial. I'm standing by my first post though, I believe it's correct.
Ok so if you are in the browser and you have this:
http://localhost/cms2/news in the URL Then you need the link with the news in front of it. However if you have this: http://localhost/cms2/news/ in the URL You need the link with out the word news in it.
Juz follow the instruction properly and make sure and double check before posting in forum
|
Welcome Guest, Not a member yet? Register Sign In |