


How to use sql statements to add custom attributes to the dedecms template in the backend of the dedecms website
How to use sql statements to add custom attributes to the dedecms template in the background of the dedecms website?
Dreamweaver dedecms template often feels that the attributes are not enough when calling articles in the frontend. We can customize many attribute tags, so that the frontend call can be very accurate, and adding is also very simple. The following is a solution I found online. Since it requires database operations, people who don’t understand should use it with caution. Otherwise, the consequences will be serious. If you delete the data table by mistake, you will say goodbye:
Recommended learning: woven Dreamcms
dedecmsHow to add the "custom attribute" label "symptom" in Dedecms
1. Enter the background - system - SQL command line tool ——Run the SQL command line and add the
code as follows:
“insert into `dede_arcatt`(sortid,att,attname) values(9,'d','症状'); alter table `dede_archives` modify `flag` set ('h','c','p','f','s','j','a','b','d') default NULL ”
The above SQL first inserts a new record (attribute to be added) into the table, and then modifies the flag field of another related table to add tag d. Yes, it's that simple, you have successfully added new attributes and can call the template. Of course, you can also use the phpmyadmin database tool to add attributes in a fool-proof way.
What needs to be explained is:
Line 1 of the code: values(9,'d','new custom attribute') is defined according to our needs, where 9 is the sortid The value is non-repeatable, that is, every time a custom attribute is added, the value of sortid should be incremented to 10, 11, 12..., and so on! d is the value of alt, which is the mark of the custom attribute, and it is the same as the existing one. The mark symbol cannot be repeated. "Symptom" is a Chinese name, which is convenient for people to intuitively understand the meaning of the custom attribute. It can be changed to other names as needed without affecting the call.
Line 2 of the code: set ('c','h','p','f','s','j','a','b','d'), The letters in brackets correspond to the existing mark symbols and the mark symbols you need to add, and they should be entered in order, and the order must not be changed. For example, d is ranked 9th, which 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 Weaver template and add code where the symptoms need to be called
The code is as follows:
{dede:arclist flag=’d’ limit=’0,1′ infolen=’230′}
3. Add documents and add the code in the custom attribute This can be achieved by checking "New Custom Attributes". The checked document will appear in any place that needs to be called in the Dream Weaver template.
The above is the detailed content of How to use sql statements to add custom attributes to the dedecms template in the backend of the dedecms website. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Notepad++7.3.1
Easy-to-use and free code editor