免签约即时到帐支付接口

ecshop调用所有商品标签云

标签云通常在个人博客中是最常见的了,但在一些ecshop商城首页也会看到不少的标签云,标签云的作用主要就是聚合相关信息来用的,比如我们上传的商品有多条,除了分为大类目之外,还可以分为聚合的小类,这些小类就是我们常常看到的tag标签了,最大的优点就是灵活度较大,想怎么写就怎么写,不受分类的限制,好了,我们下面ECSHOP插件网就来教下大家如何在ecshop首页来调用这些聚合标签吧。
第一步:打开index.php文件,找到如下代码:
    $smarty->assign('shop_notice',     $_CFG['shop_notice']);       // 商店公告
在下面加入如下代码:
    assign_dynamic('tag_cloud');
    $tags = get_tags();
    if (!empty($tags))
    {
        include_once(ROOT_PATH . 'includes/lib_clips.php');
        color_tag($tags);
    }
    $smarty->assign('tags', $tags);
第二步:打开模板里的index.dwt文件,在要显示的位置直接加入以下代码就可以了
<!-- {if $tags} -->
<!-- 标签云开始 {foreach from=$tags item=tag} -->
<span style="font-size:{$tag.size};line-height:36px">
<a href="{$tag.url}" style="color:{$tag.color}">{if $tag.bold}<b>{$tag.tag_words|escape:html}</b>{else}{$tag.tag_words|escape:html}{/if}</a>
<!-- {if $tags_from eq 'user'} -->
<a href="user.php?act=act_del_tag&amp;tag_words={$tag.tag_words|escape:url}&amp;uid={$tag.user_id}" title="{$lang.drop}"> <img src="images/drop.gif" alt="{$lang.drop}" /></a>&nbsp;&nbsp;
<!-- {/if} -->
</span>
<!-- 标签云结束 {/foreach}-->
<!-- {else} -->
<span style="margin:2px 10px;font-size:14px;line-height:36px">{$lang.no_tag}</span>
<!-- {/if} -->

本文原创地址:https://www.ecshopok.com/article-420.html
版权所有 © 转载时必须以链接形式注明出处!

觉得本文对您有用,想收藏下来!方法很简单:请点击-〉
我们一直坚持白天工作、晚上熬夜更新资源,付出了巨大的精力和时间,其中的辛酸难以言述。

文章评论

暂无评论,来发表一个吧

发表 取消
充值有惊喜 ECSHOP插件网微信客服edait_cn