Weaving Dream dedecms Home page How to invoke the content of a single document

Source: Internet
Author: User

Many friends who use the DEDECMS single-page document feature want to know how to call the content of a single-page document in the home of the dream, the following to teach you the specific implementation method:

The steps are as follows:

First, insert the following code where the first page template needs to display the contents of a single document:

{dede:sql sql= "select Body from ' dede_sgpage ' where aid = 3"function= "Htmlspecialchars (Cn_substr (@me , ()) "/] {/dede:sql}

The body of the sql= "select Body" inside the code is a single-page document content;

From ' Dede_sgpage ' here dede_sgpage is a single page document archive data table, the default is the prefix is dede_, if your database prefix modified, please fill in their own;

Where aid = 3 "AID = 3 here is the ID of our single-page document, and we need to invoke the content of the single-page document, and replace this with the ID of the document in which it is located!"

[Field:body function= "Htmlspecialchars (Cn_substr (@me, 100))"/]

Field:body the body here is also the content of a single page document;

(Cn_substr (@me, 100) Here's 100 is the number of words we are prepared to display, which can be adjusted.

Doing so will find that there is a problem with the HTML tag being called out. We need to filter it out, so we can use the following code:

{dede:sql sql= "select Body from ' dede_sgpage ' where aid = 3"function= "Htmlspecialchars (CN_SUBSTR ( Html2text (@me), (+)) "/] {/dede:sql}

Html2text () This function is the code that removes the HTML tag;

Cn_substr (str,100) This function is to intercept the string length.

This allows us to invoke the contents of a single-page document.

Transferred from: http://www.dedejs.com/html/article-673-1.html

Weaving Dream dedecms Home page How to invoke the content of a single document

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.