Home > Article > CMS Tutorial > 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='<em>推荐</em>'; else @me=''; [/field:array]
The above code can be embedded in the {dede:list} tag , a complete example is as follows:
{dede:list pagesize='10'} <li style="width:232px;"> [field:array runphp='yes'] if (@me['flag']=='c,p') @me='<em class=icotj><img src=/static/image/stamp/013.small.gif alt=推荐板 align=absmiddle /></em>'; elseif (@me['flag']=='h,p' || @me['flag']=='c,h,p') @me='<em class=icotj><img src=/static/image/stamp/012.small.gif alt=精华align=absmiddle /></em>'; else @me=''; [/field:array] <div class="c cl"> [field:array runphp='yes']@me = (empty(@me['litpic']) ? "" : "<a href='{@me['arcurl']}' title='[field:title/]' class='z'><img src='{@me['litpic']}'/></a>"); [/field:array] </div> <b class="xw0"> <a href="[field:arcurl/]" title="[field:title/]">[field:title/]</a> </b> </li> {/dede:list}
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!