Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of dream-weaving universal label {dede:sql}

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

How to use the dream-weaving universal label {dede:sql}? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

Dream-weaving universal label {dede:sql} how to use?

Dream weaving DEDECMS universal label {dede:sql}

1. The home page adds a single-page document to the background single-page document management, and enter the content generation you want in the content edit box.

two。 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 a single-page document. I believe that friends who are familiar with the SQL language can easily understand this meaning.

In fact, it means to select the data table dede_sgpage body field input, aid=2 here 2 means that you create a single-page document ID number, you can make the corresponding changes when you use it.

Another example is the sample code of the SQL tag.

{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

According to the above example, it should be easy to understand, here is mainly explained that cn_substr means to intercept 600characters, that is, 300Chinese characters. Html2Text stands for filtering out characters that contain HTML and displaying only the text.

In fact, in addition to the above example, in the Dede system, I am free to use SQL statements to make more personalized calls with dream tags. Their basic reference format is:

{dede:sql sql= "select field From table name where conditional statement"} [field: field name /] {/ dede:sql}

From the above basic format, we can basically convert a call tag for the invocation document list, the code is:

{dede:sql sql= "select * From dede_archives limit 10"} [field:title/] {/ dede:sql}

You can see that the underlying template address of the above document link is dynamic, so how do we convert it to a static address? here we just need to convert [field:id/]. The complete code after conversion is as follows:

{dede:sql sql= "SELECT * FROM dede_archives limit 10"} [field:title function=cn_substr (@ me,30,0) /] {/ dede:sql} Thank you for reading! After reading the above, do you have a general understanding of the use of the dream weaving universal label {dede:sql}? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report