A question in the CI Framework User Guide

Source: Internet
Author: User
Tags php foreach codeigniter

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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.