Home  >  Article  >  CMS Tutorial  >  How to realize that if there are thumbnails in the Dreamweaver list, the thumbnails will be displayed

How to realize that if there are thumbnails in the Dreamweaver list, the thumbnails will be displayed

藏色散人
藏色散人Original
2020-01-03 09:11:031701browse

How to realize that if there are thumbnails in the Dreamweaver list, the thumbnails will be displayed

How to display thumbnails in the Dreamweaver list if there are thumbnails?

If there is a thumbnail in the DEDECMS list, the thumbnail will be displayed. If there is no thumbnail, the image will not be displayed.

Recommended learning: 梦Weavercms

Many friends who use DEDECMS to build websites want to implement this function. Sometimes articles may not always be equipped with pictures, so they want to display thumbnails if there are thumbnails, and not display pictures if there are no thumbnails.

You can modify the implementation according to the following method, open the file (this is the default template)

Find the following code:

[field:array runphp=&#39;yes&#39;]@me = (emptyempty(@me[&#39;litpic&#39;]) ? "" : "<a class="preview" href="{@me["><img src="{@me[" alt="" /></a>"); [/field:array]

Replace it with the following code:

[field:array runphp=&#39;yes&#39;]@me = (strpos(@me[&#39;litpic&#39;],&#39;defaultpic&#39;) ? "" : "<a href=&#39;{@me[&#39;arcurl&#39;]}&#39; class=&#39;preview&#39;><img src=&#39;{@me[&#39;litpic&#39;]}&#39;/></a>"); [/field:array]

Then regenerate the list page again.

The above is the detailed content of How to realize that if there are thumbnails in the Dreamweaver list, the thumbnails will be displayed. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn