Welcome Guest, Not a member yet? Register   Sign In
Can't finish tutorial.
#1

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.
Reply
#2

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'?>
Reply
#3

(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
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.


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.
Reply
#4

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>
Reply
#5

(This post was last modified: 04-20-2015, 12:05 AM by Muzikant.)

It was changed, because in our case it worked in opposite way: Userguide CI 3.0 error.
Reply
#6

(This post was last modified: 04-20-2015, 02:37 AM by ChicagoPhil.)

(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.
Reply
#7

(This post was last modified: 04-20-2015, 07:03 PM by ChicagoPhil.)

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.
Reply
#8

Juz follow the instruction properly and make sure and double check before posting in forum Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB