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

How to implement random call of list page thumbnail by dedecms

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

Share

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

This article is about how dedecms implements random calls to list page thumbnails. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

How does dedecms implement random calls to list page thumbnails?

Friends who have used DEDECMS should know that some template list pages need to use thumbnails, and the thumbnails in the calling content can call the first image using the script that comes with the system. However, not all of our content has pictures, and sometimes the first picture is not necessarily the right size of the standard thumbnail size, in short, the user experience is not good, especially if editors forget or do not upload thumbnails, it is bound to affect the site.

Recommended study: dream weaving cms

The steps for random call of thumbnails are as follows:

1. Previously, the script in our template that called the thumbnail looked like this:

The code is as follows:

[field:array runphp='yes'] @ me = (empty (@ me ['litpic'])? ":"

"); [/ field:array]

two。 Need to be replaced with what I have prepared:

The code is as follows:

3. Upload the following JS file and the prepared image to the host.

The code is as follows:

Var massif 20; var n=Math.floor (Math.random () * mx1) [xss_clean] ("

")

Need to pay attention to a problem, we had better prepare 20-30 fixed thumbnail size pictures, because the fixed size layout is better, will not compress deformation. If you list 10 content, if only 10 pictures will cause several pictures to repeat randomly, the experience is not very good, and if you have more pictures, you will be less likely to repeat. That's it. Refer to it if you need it.

Thank you for reading! On how dedecms to achieve the list page thumbnail random call to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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