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