Home > CMS Tutorial > DEDECMS > How to add custom attributes in dede

How to add custom attributes in dede

藏色散人
Release: 2019-12-12 09:51:33
Original
1808 people have browsed it

How to add custom attributes in dede

dedeHow to add custom attributes?

Many times when building a website, we need to create as many secondary columns as possible to classify articles. It’s better to have fewer columns. If a column involves level 2 or level 3 columns, then as the As the number of columns increases, it will be very difficult to add articles in the future. Today, the editor will teach you how to solve the cumbersome article classification problem by adding custom attributes to articles.

Recommended study: 梦Weavercms

If the custom attributes are used well, it can completely solve the problem that an article belongs to multiple columns, or there are 2-3 levels under the columns. sub-column and other issues!

Environment: DEDE is currently updated to version 5.7. The old version before this will not be described. We use DEDE5.7 as the basis for modification.

First, let’s take a look at how to add custom article attributes in batches.

The safer and faster way to add is through SQL writing: Backend-System-SQL command line tool.

insert into `dede_arcatt`(sortid,att,attname) values(9,'d','标签');
alter table `dede_archives` modify `flag` set ('c','h','p','f','s','j','a','b','d') default NULL;
Copy after login

We need to say something here, because DEDE itself already has 8 default attributes, so we start to add the 9th column, and so on, "d" is to distinguish our front desk through flag ='d' to call the label, as long as it is not repeated.

How to add custom attributes in dede

The above is where we add an attribute. If we have a lot of attributes to replace the second and third level columns, how to do it? Directly look at the strength

insert into `dede_arcatt`(sortid,att,attname) values(9,'d','标签1');
insert into `dede_arcatt`(sortid,att,attname) values(9,'d1','标签2');
insert into `dede_arcatt`(sortid,att,attname) values(9,'d2','标签3');
 
……
 
alter table `dede_archives` modify `flag` set ('c','h','p','f','s','j','a','b','d','d1','d2') default NULL;
Copy after login

This method can completely solve the problem of adding article attributes in batches!

How to add custom attributes in dede

We can see that this is the effect of our batch addition, but have you noticed that the added attributes have been mixed with the previous built-in attributes? It will be very troublesome for the editor to add it. Let’s give a little trick here:

We add an unused attribute tag in front of the default attribute tag and the attribute tag that needs to be added! Then we make this tag through the database A little bit of manipulation.

How to add custom attributes in dede

How to add custom attributes in dede

How to add custom attributes in dede

Do you understand? In fact, I use this small symbol and line breaks to isolate the custom attributes of the articles I added, so that the editor can see them clearly when adding content.

Regarding the issue of using this custom attribute to perfectly operate the column classification, we will slowly take care of it in the following content.

The above is the detailed content of How to add custom attributes in dede. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template