How to add a custom field to the Dede column settings (Dede two development-pure copy paste)

Source: Internet
Author: User

How to add a custom field to the Dede column setting this is not seen before, very few customers will put forward such a request two times, today the Weaver Dreamer on the net to see this article turned around to share with you

In view of this tutorial no one sent, online search more people. So I made a.

For example I want to add: column pictures, and column keywords and so on. Whatever you want. Good. Let's start now.

First, we're going to go in. Add fields to MySQL database and name them well! For example, I added a column search key field below, of course, you can create a new field of the table Dede_arctype (this is the Column model database table, the front is the name of the table you installed, novice to note, do not ask me, I can't find this table)

Attention. Here the birds skip over

and then tap

Picture 1

When you click Add Field

Picture 2

Add Field

Picture 3

Here the database fields are added.

Then we started backstage. We write to find the Backstage column management template!

2 D:\www\dede\templets templates to change: catalog_add.htm, catalog_edit.htm

Here is a demonstration of a

Picture 4

And then add the field form, which is usually everyone's

The code I added is:

<tr>
<TD height= > column search keywords:</td>
<td> <textarea name= "Lanmukeywrod" cols= "All" rows= "4" id= "Lanmukeywrod" class= "Alltxt" ><?php echo $ myrow[' Lanmukeywrod ']?></textarea>
</td>
</tr>

Here's a note for everyone. The name and ID of the form should be the same as the MySQL table field you added, not the case. Also write a more value code. The same thing. The default dedecms is automatically taken, and then we do the last one, adding the data.

People found: D:\www\dede\catalog_edit.php

The catalogue may not be the same as everyone else is the backstage catalog_edit.php,catalog_add.php

catalog_edit.php to change the place are:

38 rows

$upquery = "Update ' Dede_arctype ' Set
Issend= ' $issend ',
sortrank= ' $sortrank ',
Typename= ' $typename ',
Typedir= ' $typedir ',
isdefault= ' $isdefault ',
Defaultname= ' $defaultname ',
Issend= ' $issend ',
Ishidden= ' $ishidden ',
Channeltype= ' $channeltype ',
tempindex= ' $tempindex ',
Templist= ' $templist ',
Temparticle= ' $temparticle ',
Namerule= ' $namerule ',
Namerule2= ' $namerule 2′,
Ispart= ' $ispart ',
corank= ' $corank ',
Description= ' $description ',
Keywords= ' $keywords ',
Moresite= ' $moresite ',
' Cross ' = ' $cross ',
' Content ' = ' $content ',
' Crossid ' = ' $crossid ',
' Smalltypes ' = ' $smalltypes '
$uptopsql
where id= ' $id ';

Add the fields we just entered in the SQL statement. Which is the code below.

$upquery = "Update ' Dede_arctype ' Set
Issend= ' $issend ',
sortrank= ' $sortrank ',
Typename= ' $typename ',
Typedir= ' $typedir ',
isdefault= ' $isdefault ',
Defaultname= ' $defaultname ',
Issend= ' $issend ',
Ishidden= ' $ishidden ',
Channeltype= ' $channeltype ',
tempindex= ' $tempindex ',
Templist= ' $templist ',
Temparticle= ' $temparticle ',
Namerule= ' $namerule ',
Namerule2= ' $namerule 2′,
Ispart= ' $ispart ',
corank= ' $corank ',
Description= ' $description ',
Keywords= ' $keywords ',
Moresite= ' $moresite ',
' Cross ' = ' $cross ',
' Content ' = ' $content ',
' Crossid ' = ' $crossid ',
' Smalltypes ' = ' $smalltypes ',
' Lanmukeywrod ' = ' $lanmukeywrod '
$uptopsql
where id= ' $id ';

See this is added: ' Lanmukeywrod ' = ' $lanmukeywrod '

This is the update column. Catalog_add.php added. and the same way.

The change addresses are: 63 lines and 196 rows. It's the same way. Add field information to SQL

The changed code:

63 lines:

$queryTemplate = "INSERT INTO ' dede_arctype ' (Reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend, Channeltype,
Tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords,moresite,siteurl, Sitepath,ishidden, ' Cross ', ' crossid ', ' content ', ' smalltypes ', ' Lanmukeywrod ')
Values (' ~reid~ ', ' ~topid~ ', ' ~rank~ ', ' ~typename~ ', ' ~typedir~ ', ' $isdefault ', ' $defaultname ', ' $issend ', ' $ Channeltype ',
' $tempindex ', ' $templist ', ' $temparticle ', ' Default ', ' $namerule ', ' $namerule 2′, ' 0′, ' 0′, ', ', ' 0′, ', ', ' 0′, ' 0′, ' 0′, ', ' , ' $lanmukeywrod ') ";

Added the Lanmukeywrod

196 lines:

$in _query = "INSERT INTO ' dede_arctype ' (Reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend, Channeltype,
Tempindex,templist,temparticle,modname,namerule,namerule2,
Ispart,corank,description,keywords,moresite,siteurl,sitepath,ishidden, ' Cross ', ' crossid ', ' content ', ' smalltypes ' , ' Lanmukeywrod ')
Values (' $reid ', ' $topid ', ' $sortrank ', ' $typename ', ' $typedir ', ' $isdefault ', ' $defaultname ', ' $issend ', ' $ Channeltype ',
' $tempindex ', ' $templist ', ' $temparticle ', ' Default ', ' $namerule ', ' $namerule 2′,
' $ispart ', ' $corank ', ' $description ', ' $keywords ', ' $moresite ', ' $siteurl ', ' $sitepath ', ' $ishidden ', ' $cross ', ' $ Crossid ', ' $content ', ' $smalltypes ', ' $lanmukeywrod ');

Here's how to call to the foreground

{dede:field.lanmukeywrod/}

In the template call this can be, if everyone is another field is the same call, followed by the field name can be.

All right, I'm done. tutorials, if you reprint please famous source: http://www.002t.cn/yingxiaoyuwangluo/693.html Soft Studio (Xiao Dai)

I can see it. The author is a person who is good at discovering and dealing with problems.

With version network-professional weaving dream Template Download platform, reproduced please specify the source: http://www.genban.org/news/dedecms-2281.html

How to add a custom field to the Dede column settings (Dede two development-pure copy paste)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.