首页常用调用代码案例【可在任意页面使用】
TAG标签
{volist name=":db_select('tag', ['open' => 1, 'type' => 0], '20', 'px desc')" id="vo"}
<a href="{:url('index/tags', ['id' => $vo.name])}">
{$vo.name}
</a>
{/volist}
网站数据【工具】
{volist name=":db_select('website', ['open' => 1, 'tool' => 1], '20', 'settop desc, id desc')" id="v"}
{if $v.tips}{$v.tips}{/if} <!-- 自定义提示 -->
{$v.ico} <!-- ico图标 -->
{$v.title} <!-- 网址标题 -->
{:cut(preg_replace('/###/is', '', $v.content), 40)} <!-- 40个字符网址描述 -->
{:url('index/url', ['id' => $v.id])} <!-- 直接访问 -->
{:url('index/website', ['id' => $v.id])} <!-- 查看详情 -->
{if $v.settop == 1}置顶操作{/if}
{/volist}
分类
{volist name=":db_select('website_cate', ['open' => 1], '20', 'px desc')" id="vo"}
{$vo.name} <!-- 分类名称 -->
{:url('index/category', ['id' => $vo.id])} <!-- 分类链接 -->
{/volist}
分类下的数据
{volist name=":db_select('website_cate', ['open' => 1], '20', 'px desc')" id="vo"}
{$vo.name} <!-- 分类名称 -->
{:url('index/category', ['id' => $vo.id])} <!-- 分类链接 -->
{volist name=":db_select('website', ['open' => 1, 'tid' => $vo.id], '20', 'settop desc, id desc')" id="v"}
{if $v.tips}{$v.tips}{/if} <!-- 自定义提示 -->
{$v.ico} <!-- ico图标 -->
{$v.title} <!-- 网址标题 -->
{:cut(preg_replace('/###/is', '', $v.content), 40)} <!-- 40个字符网址描述 -->
{:url('index/url', ['id' => $v.id])} <!-- 直接访问 -->
{:url('index/website', ['id' => $v.id])} <!-- 查看详情 -->
{if $v.settop == 1}置顶操作{/if}
{/volist}
{/volist}
友情链接
{volist name=":Db::name('link')->where(['open' => 1, 'wz' => 9])->whereTime('show_time', '>=', date('Y-m-d H:i:s'))->order('px desc')->select()" id="vo"}
<a href="{$vo.lianjie}" {if $vo.xin}target="_blank"{/if} rel="{$vo.rel}">
{$vo.name}
</a>
{/volist}
导航链接
{volist name=":Db::name('link')->where(['open' => 1, 'wz' => 1])->order('px desc')->select()" id="vo"}
<li>
<a rel="{$vo.rel}" {if $hover == explode(',', $vo['hover'])[0] || $hover == explode(',', $vo['hover'])[1]}class="active"{/if} href="{$vo.lianjie}" {if $vo.xin}target="_blank"{/if}>
<i class="fa {$vo.pic}"></i>{$vo.name}
</a>
</li>
{/volist}
底部链接
{volist name=":Db::name('link')->where(['open' => 1, 'wz' => 2])->order('px desc')->select()" id="vo"}
<a href="{$vo.lianjie}" {if $vo.xin}target="_blank"{/if} rel="{$vo.rel}">{$vo.name}</a>
{/volist}