Home > CMS Tutorial > DEDECMS > body text

How to determine the custom attributes of articles when DreamWeaver calls the article list

藏色散人
Release: 2020-01-03 09:19:34
Original
1936 people have browsed it

How to determine the custom attributes of articles when DreamWeaver calls the article list

#How to determine the custom attributes of articles when Dreamweaver calls the article list?

Dreamweaver dedecms determines the article custom attributes when calling the article list

Recommended learning: Dreamweaver cms

Sometimes we need to pass Determine the attributes of the article to give corresponding styles to the corresponding attributes, such as adding recommended signs to recommended articles, etc.

For example, the following code can determine whether the article has two attributes: recommendation and picture, and output it in different styles:

[field:array runphp='yes']
 if (@me['flag']=='c,p') 
@me=&#39;<em>推荐</em>&#39;;
else @me=&#39;&#39;;
[/field:array]
Copy after login

The above code can be embedded in the {dede:list} tag , a complete example is as follows:

{dede:list pagesize=&#39;10&#39;}
<li style="width:232px;">   
[field:array runphp=&#39;yes&#39;]
 if (@me[&#39;flag&#39;]==&#39;c,p&#39;) @me=&#39;<em class=icotj><img src=/static/image/stamp/013.small.gif alt=推荐板 align=absmiddle /></em>&#39;;
elseif (@me[&#39;flag&#39;]==&#39;h,p&#39; || @me[&#39;flag&#39;]==&#39;c,h,p&#39;) @me=&#39;<em class=icotj><img src=/static/image/stamp/012.small.gif alt=精华align=absmiddle /></em>&#39;;
else @me=&#39;&#39;;
[/field:array]  
<div class="c cl">
[field:array runphp=&#39;yes&#39;]@me = (empty(@me[&#39;litpic&#39;]) ? "" : "<a href=&#39;{@me[&#39;arcurl&#39;]}&#39; title=&#39;[field:title/]&#39; class=&#39;z&#39;><img src=&#39;{@me[&#39;litpic&#39;]}&#39;/></a>"); [/field:array]
</div>
<b class="xw0">
<a href="[field:arcurl/]" title="[field:title/]">[field:title/]</a>
</b>
</li>
{/dede:list}
Copy after login

The above is the detailed content of How to determine the custom attributes of articles when DreamWeaver calls the article list. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template