Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The Application of JavaScript in DEDECMS Slide

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

How does JavaScript apply in DEDECMS slides? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

How to apply JavaScript in DEDECMS slides?

Today, I encountered a small problem when making the template, but it was finally solved by consulting all kinds of materials on the website.

Since this problem happens to have a little to do with the JavaScript that Zero learned recently, Zero makes a small summary of the problem and how to integrate JavaScript slide effects with DEDECMS call tags.

Question: how to insert a slide in the DEDECMS column page and realize the automatic transfer of the picture, title and description in the slide at the same time.

First, find a favorite slide special effect code.

With what I have learned so far, it is impossible to make a slide show. What if I can't do it? Look for source code on the Internet, of course, there are many web sites with source code, but Zero does not advocate it, so you should work hard to learn to bid farewell to this borrowlism.

Second, insert the slide code found into the relevant location of the column template.

The insertion method is also very simple, to the need to change some of the path of the calling code, which I think most friends can understand. (and don't forget to add the call JS file to the header)

Take the slide source file used by Zero as an example:

JS call file

Insert page JS code

Of course, after the call, you have to put the call file under the corresponding directory file.

Step 3: picture call code

It's easy to just put the light chip on the web page. However, it is not so easy to implement automatic calls to pictures, title, and descriptions in slides, at least Zero thinks it is not so easy to complete (especially when the JS file cannot be modified).

Here are the slide source files Zero looked for online:

The code is as follows:

From the source code of the slide, we can see that all the pictures, title and descriptions of this slide are fixed and cannot be used flexibly. If we want to achieve flexible invocation, we have to use the call tag of DEDE, where Zero uses the dede:arclist tag to implement the call. However, we need to pay attention to the following points when calling:

1. # separation, since the end of the last piece of data does not need to be separated, so 1-4 and the last item need to be processed separately. Here Zero is implemented with limit tags, and limit tags will be described in detail when they come into contact with the mysql database in the future.

2. There can be no spaces between two pieces of data, that is to say, spaces and line breaks are not allowed between two pieces of data like images/01.jpg###images/02.jpg, and if so, it cannot be run. What if arclist calls data with spaces and line breaks automatically? Modify $artlist. = $dtp2- > GetResult (). "\ r\ n" in line 413 of the arclist.lib.php file; change it to: $artlist. = $dtp2- > GetResult (). (of course, the same effect can be achieved by adjusting JS, but Zero is not familiar with JS so it can only be achieved by modifying the DEDECMS source code.)

3. Decorating code cannot appear in the title tag in the slide, such as "

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report