How to use the Dreamweaver universal tag {dede:sql}?
Dreamweaver DEDECMS universal tag {dede:sql}
1. On the homepage, add a single-page document and content editing box in the background single-page document management Enter the content you want to generate.
2. Add the SQL universal tag {dede:sql sql="select body from dede_sgpage where aid=2"}[field:body /]{/dede:sql} where you need to call the single-page document I believe that friends who are familiar with SQL language can easily understand the meaning of this sentence.
The actual meaning is to select the body field input of the data table dede_sgpage. The 2 here in aid=2 means that you create a single-page document ID number. You can make corresponding modifications when using it.
Another example is this SQL tag sample code
{dede:sql sql="select content from dede_arctype where id=2"} [field:content function=cn_substr(Html2Text(@me),600)/] {/dede:sql}
Recommended study:dedecms tutorial
Based on the above example, it should be easy to understand, The main explanation here is that cn_substr means intercepting 600 characters, which is 300 Chinese characters. Html2Text means to filter out characters containing HTML and only display text.
In fact, in addition to the above examples, in the Dede system, I can freely use SQL statements to make more personalized calls with the DreamWeaver tag. Their basic reference format is:
{dede:sql sql="select 字段 From 表名称 where 条件语句"} [field:字段名/] {/dede:sql}
From the above basic format, we can basically convert a call tag that calls the document list, the code is:
You have seen that the underlying template address of the document link above is dynamic, so how do we convert it so that it can be linked to a static address? Here we only need to convert [field:id/], The complete code after conversion is:
{dede:sql sql="SELECT * FROM dede_archives limit 10"}
The above is the detailed content of How to use the Dreamweaver universal tag {dede:sql}. For more information, please follow other related articles on the PHP Chinese website!