Original: JS code, let DEDECMS support tag selection, add content more convenient, without hand lose tag

Source: Internet
Author: User
Tags urlencode

Dedecms when editing the content, tag tags need to manually lose, the Chinese tag, the middle also have to use half-width character ', ' separation, input method Che cut very inconvenient, so the background code, use the background tags_main.php, let dedecms add content can go Tags_ Main to choose.

1. Open the \dede\templets\album_add.htm file and add the JS method to the JS script area at the top head.

functionvar tagg=window.showmodaldialog ("tags_main.php", "tag", "dialogwidth=800px"; dialogheight=600px ");     if (typeof (Tagg)! = ' undefined ') document.form1.tags.value=tagg;              }

2. In the TD labeled tag Input, add

<type= "button"  onclick= "Setag ()"  value= " Select "  style=" Width:70px;cursor:pointer; />

a button.

3. Transform the \dede\templets\tags_main.php file. Add the following JS code to the JS script area at the top head.

// Select keywords var tag= ""; function Selecttag (str) {tag=tag+ "," +str; if (TAG.SUBSTR (0,1) = = ', ') tag=tag.substr (1); $ ("#selecttag"). val (tag);} function Selecttagok () {Window.returnvalue= $ ("#selecttag"). Val ();  Window.close ();  }

4. Add the following HTML to the body anywhere, PS: The place you want to display.

<Divstyle= "padding-left:20px;border:1px">Selected tag:<inputtype= ' text 'ID= ' Selecttag 'name= ' Selecttag 'size= ' + '/><inputtype= "button"OnClick= "Selecttagok ()"value= "OK Selection"/>  </Div>

5. In the tag list, locate the

<href= "... /tags.php?/<?php Echo UrlEncode ($fields [' tag ']); >/"  target=" _blank ">{ Dede:field.tag/}</a>

Modify it to:

<href= "... /tags.php?/<?php Echo UrlEncode ($fields [' tag ']); >/"  target=" _blank ">{ Dede:field.tag/}</a><href= "#" onclick = "Selecttag (' {dede:field.tag/} ')" > Select </ a >

Use Help:

Modify the page to refer to the Add page for JS code additions.

Anti-Wall Google:www.gaomn.com

Heat Map Bar: www.retu8.com

Sexy beauty: http://www.8kmm.com

Original: JS code, let DEDECMS support tag selection, add content more convenient, without hand lose tag

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.