Discuz DIY tip: Add drag-and-drop areas to the template

Source: Internet
Author: User
1. Add more drag-and-drop areas to a template that already has a drag-and-drop area.


In discuz! In most template files of the default X1 template, two to three drag-and-drop areas have been built in. But what if you think this is not enough, you need to add more drag-and-drop areas?

Open the template file where you want to add a drag-and-drop area, and add the following code to the location you want to add:

  1. <! -- [DIY = diyid] --> <Div id = "diyid" class = "area"> </div> <! -- [/DIY] -->

Copy code

Note: diyid in [DIY = diyid] must be the same as the ID of the subsequent Div, and must be unique on the page, that is, it cannot be the same as the existing element ID on the page.

2. Add a drag-and-drop area to a template that does not have a drag-and-drop area or a new template page.


A) add a tag for storing CSS code in the template file. The Code is as follows:

  1. <Style id = "diy_style" type = "text/CSS"> </style>

Copy code

B) add a drag-and-drop area to the template file.

  1. <! -- [DIY = diyid] --> <Div id = "diyid" class = "area"> </div> <! -- [/DIY] -->

Copy code

Note: diyid in [DIY = diyid] must be the same as the ID of the subsequent Div, and must be unique on the page, that is, it cannot be the same as the existing element ID on the page.


C) load the drag-and-drop template in the program code (PHP file)

Take the template/default/home/testtpl.htm as an example:

The method for loading a normal template is:

  1. Template ('home/testtpl ');

Copy code

DIY template loading method:

  1. Template ('diy: Home/testtpl ');

Copy code

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.