Everyone knows DedeCms The list page thumbnail of DedeCMS extracts the first picture by default. However, not all articles have pictures to call, and sometimes the first picture may not be suitable for the size of the list thumbnail. This experience is not good, so we can implement random call of the list page thumbnail through modification.
The steps of thumbnail random call mode are as follows:
Step 1 , Dream weaving template The label for calling thumbnails in is as follows:
[field:array runphp='yes']@me = (empty(@me['litpic']) ? "" : "<a href='{@me['arcurl']}' class='preview'><img src='{@me['litpic']}'/></a>"); [/field:array]
Step 2 , need to be replaced with the one I have prepared:
<a href="[field:arcurl/]" title="[field:title/]" target="_blank"><script language="JavaScript" src="/images/road.js"></script></a>
Step 3 , upload the road.js file to the images directory:
var m=20;
var n=Math.floor(Math.random()*m+1)
document.write ("<img src=' //www. Your website: com/images/nt "+n+". jpg 'border=0 width=148 height=118/>");
Note: Create a new js file, copy the code above, and change the URL in the code to your URL. The width and height behind are thumbnail width and height, and you can set the size by yourself.
Step 4 , upload the prepared thumbnail to the images directory:
You can prepare many thumbnails, upload them to the/images directory folder, and then the thumbnails of the list page will automatically call these pictures.
Statement: All articles on this site, unless otherwise specified or marked, are originally published on this site. No individual or organization is allowed to copy, embezzle, collect and publish the content of this website to any website, book and other media platforms without the consent of this website. If the content of this website infringes upon the legitimate rights and interests of the original author, please contact us for handling.