您的位置:首页 > 其它

yxcms调用热点文章判断显示图标问题

2016-12-29 00:00 246 查看
使用yxcms做热点文章调用的时候,可能大家会想到一个效果,就是前三个是红色的图标,后面的就是灰色的,这个也是很常用的,今天给大家上代码,说说方法,其实yxcms已经有很好的二次开发和实用性。





这个是效果,代码如下:

<ul class=“m_tjnews”>

{hot:{table=(news) field=(id,title,color,addtime,method) order=(hits desc,id desc) where=(ispass=’1′) limit=(10)}}

{if $hot_i<=3}

<li class=“tj_n_hong”><span class=“tjnews_num”>[hot:i]</span><a style=“color:[hot:color]“ title=“[hot:title]“ target=“_blank” href=“{url($hot['method'],array(‘id’=>$hot['id']))}”>[hot:title $len=11]</a></li>

{else}

<li><span class=“tjnews_num”>[hot:i]</span><a style=“color:[hot:color]“ title=“[hot:title]“ target=“_blank” href=“{url($hot['method'],array(‘id’=>$hot['id']))}”>[hot:title $len=11]</a></li>

{/if}

{/hot}

</ul>

css代码:

.m_tjnews{border:1px solid #cdcdcd; border-top:none; margin-bottom:10px; }

.m_tjnews li{ height:33px; line-height:33px; vertical-align:middle; border-bottom:1px dotted #d6d6d6; *zoom:1;position: relative;}

.m_tjnews li a{ margin-left:30px; font-size:16px;}

.m_tjnews li a:hover{ color:#ca0e0c;}

/*xinwen num*/

.tjnews_num {position: absolute; display: inline-block;*display: inline;*zoom:1;width: 16px;height: 16px;line-height: 16px;text-align: center;font-size: 10px;background: #ccc;color: #fff;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius:5px;margin-right: 7px;vertical-align: middle;top: 9px;left: 5px;}

.tj_n_hong .tjnews_num {background-color: #ca1010;}

这样就可以试试yxcms做出调用热点文章。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息