Welcome Guest, Not a member yet? Register   Sign In
Tutorial for CI 3 - news section - bug found
#1

In the tutorial at creation of application/views/news/index.php (on http://www.codeigniter.com/user_guide/tu...ction.html) is a detail missing.
The line
<p><a href="<?php echo $news_item['slug'] ?>">View article</a></p>
does not work, because the created link is only the slug, but it must be news/slug. The following change corrects the issue (and was also part of the documentation for CI 2).
<p><a href="news/<?php echo $news_item['slug'] ?>">View article</a></p>

Can anyone confirm this?

Thanks

PBI
Reply
#2

There's a routes section at the end of that page and you need to complete it.
Reply
#3

you're right.
Thanks
Reply
#4

(This post was last modified: 08-20-2015, 01:39 PM by Carpintonto. Edit Reason: misstated db error )

A separate issue in the same section -

Seems the documentation/tutorial is just a bit behind  the code version 3

Where the sql example
Code:
CREATE TABLE news (
       id int(11) NOT NULL AUTO_INCREMENT,
       title varchar(128) NOT NULL,
       slug varchar(128) NOT NULL,
       text text NOT NULL,
       PRIMARY KEY (id),
       KEY slug (slug)
);

the example News_model.php will actually look for table CodeIgniternews because application/config/database.php now has

Quote:'dbprefix' => 'CodeIgniter',   //line # 72

instead of an empty string for dbprefix.

For my first run through, I am modifying the code to work with the tutorial.
Reply
#5

(08-20-2015, 01:13 PM)Carpintonto Wrote: A separate issue in the same section -

Seems the documentation/tutorial is just a bit behind  the code version 3

Where the sql example

Code:
CREATE TABLE news (
       id int(11) NOT NULL AUTO_INCREMENT,
       title varchar(128) NOT NULL,
       slug varchar(128) NOT NULL,
       text text NOT NULL,
       PRIMARY KEY (id),
       KEY slug (slug)
);

the example News_model.php will actually look for table CodeIgniternews because application/config/database.php now has


Quote:'dbprefix' => 'CodeIgniter',   //line # 72

instead of an empty string for dbprefix.

For my first run through, I am modifying the code to work with the tutorial.

That prefix is never suggested by the tutorial.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB