When learning the CI framework, we look at the Simplified Chinese translation of the official User's Guide. The slug word appeared in the tutorial, no translation was given and it was difficult to understand.
Slug is in this section of the read news entry, which is part of the tutorial here:
Http://codeigniter.org.cn/user_guide/tutorial/index.html
In this tutorial, there is a piece of code that shows the added news item, which is the presentation of the data, which is the code in application/views/news/index.php (Tutorial page http://codeigniter.org.cn/ user_guide/tutorial/news_section.html):
">View article
And I finished all the tutorials, including the "Create News Entry" section later, and then open the browser access to create a news page: Http://192.168.56.101/ciguestbook/index.php/news/create (deployed in the virtual machine) , randomly fill in the test data submitted and then jump to the news show page http://192.168.56.101/ciguestbook/index.php/news/, there is a right-click View Article this link found slug value is empty!
Yes, it's in index.php.
">View article
The news_item[' slug ' in this sentence is empty. For the meaning of the slug itself and the meaning of PHP in the sense of confusion, and slug here for empty expression puzzled, slug since the empty why the tutorial to set it?
Reply content:
When learning the CI framework, we look at the Simplified Chinese translation of the official User's Guide. The slug word appeared in the tutorial, no translation was given and it was difficult to understand.
Slug is in this section of the read news entry, which is part of the tutorial here:
Http://codeigniter.org.cn/user_guide/tutorial/index.html
In this tutorial, there is a piece of code that shows the added news item, which is the presentation of the data, which is the code in application/views/news/index.php (Tutorial page http://codeigniter.org.cn/ user_guide/tutorial/news_section.html):
">View article
And I finished all the tutorials, including the "Create News Entry" section later, and then open the browser access to create a news page: Http://192.168.56.101/ciguestbook/index.php/news/create (deployed in the virtual machine) , randomly fill in the test data submitted and then jump to the news show page http://192.168.56.101/ciguestbook/index.php/news/, there is a right-click View Article this link found slug value is empty!
Yes, it's in index.php.
">View article
The news_item[' slug ' in this sentence is empty. For the meaning of the slug itself and the meaning of PHP in the sense of confusion, and slug here for empty expression puzzled, slug since the empty why the tutorial to set it?
I'll give the correct answer to the question.
Slug is a semantically customizable article name URL in the wordpress system
I was also very puzzled, looked a lap found. In fact, from the URL can be seen, followed by /news
, do not give a unique expression how to know which news.
First look at the table structure
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));
Note that each article has slug, and then look at the translation of Slug: "(title, etc.) compelling statements, eye-catching statements (or phrases)", is actually the lead or introduction of each article. If it is empty, this article does not have the introduction.
This is my understanding.