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 method of adding custom attributes to dedecms templates by using SQL statements in the background of dedecms website

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

How to add custom attributes to dedecms templates using SQL statements in the background of dedecms website? 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!

How does the dedecms site background use SQL statements to add custom attributes to dedecms templates?

When the foreground of the dream-weaving dedecms template calls the article, we often feel that the attributes are not enough. We can customize a lot of attribute tags, so that the foreground can be very accurate when calling, and it is also very simple to add. Here is the solution I found on the Internet. People who do not understand it should be careful to use it because of the database operation, otherwise the consequences will be very serious, and the data table will be deleted say goodbye by mistake:

Recommended study: dream weaving cms

How to add "Custom attributes" tag "symptoms" to dedecms Dream Weaving

1. Enter the background-system-SQL command line tool-run the SQL command line, and add

The code is as follows:

"insert into 'dede_ Arcatt` (sortid,att,attname) values (9 dede_ archives` modify `symptoms'); default NULL ('haggling, pairing, paging, paging, writing, etc.) default NULL"

The above SQL inserts a new record (the attribute to be added) in the table, and then modifies the flag field of another associated table to add the label d. Yes, it's as simple as that. You have successfully added new attributes and can be called by templates. Of course, you can also use the phpmyadmin database tool to add attributes foolishly.

What needs to be explained is:

Line 1 of the code: values is defined according to our needs, where 9 is the value of sortid, which is not repeatable, that is, each time a custom attribute is added, the value of sortid should be incremented to 10Mag11 12. , and so on! d is the value of alt, is the tag of the custom attribute, and cannot be repeated with the existing tag symbol. "symptom" is a Chinese name, which is convenient for people to intuitively abstain from the meaning of the custom attribute. It can be changed to another name as needed, without affecting the call.

Line 2: set. The letters in parentheses correspond to the existing mark symbols and the mark symbols you need to add, and enter them in order, without changing the order. For example, if d sorts the 9th bit, it corresponds to the custom attribute "comment d" added in the first line of code.

2. Backend-template-default template management-index.htm

Make changes in the "index.htm" dream weaving template to add code where symptoms need to be invoked

The code is as follows:

{dede:arclist flag='d' limit='0,1' infolen='230'}

3, add a document, in the custom properties will be "new custom properties" check, you can achieve, check the document appears in the dream template any need to call.

Thank you for reading! After reading the above, do you have a general idea of how to add custom attributes to the dedecms template using SQL statements in the background of the dedecms website? 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