[TOC]
公共文件相关文档例如 js,css,图片引入当操作 地址公共文件使用教程
大图调用的文章所在栏目封面图使用条件判断进行显示 如果当前栏目为设置封面图就调用
https://www.hbsjsd.cn/public/static/index/uploads/img\20191210\79bc1e206058ba90fc889eaf586e95e6.jpg
默认图标否者调用栏目封面图
<img src="{if condition="$topCates['img'] eq ''"}https://www.hbsjsd.cn/public/static/index/uploads/img\20191210\79bc1e206058ba90fc889eaf586e95e6.jpg{else/}/{$topCates.img}{/if} " style="width: 100%; height:100%" alt="{$cates.cate_name}">
返回数据格式
"id" => 9
"cate_name" => "帮助中心"
"title" => "" //栏目名称
"keywords" => ""//关键词
"desc" => ""//描述
"content" => ""//内容
"status" => 1//审核状态
"jump_id" => 0//是否跳转
"img" => ""//封面图
"cate_attr" => 1 //栏目类型 1列表页 2单页 3跳转 使用类型2【/index_tmp】类型【list_tmp】【article_tmp】无效 ,使用类型3【/article_tmp】者【index_tmp】【index_tmp】无效
"list_tmp" => "list_article.html" //跳转列表页
"index_tmp" => "index_article.html" //单页地址
"article_tmp" => "article_article.html" //内容页
"link" => ""//类型3跳转页
"sort" => 50//栏目排序
"model_id" => 1
"bottom_nav" => 0//是否底部显示0显示1不显示
"pid" => 0//顶级栏目标识 0为顶级
"mark" => ""
"thumb" => 1
"uid" => 1
格式基本可以固定 判断栏目类型更具不同类型跳转栏目不同
{volist name="pos" id="cate"}
<a href='{if condition="$cate['cate_attr'] eq 1"}{:url('cate/index',array('cid'=>$cate['id']))}{/if}
{if condition="$cate['cate_attr'] eq 2"}{:url('page/index',array('cid'=>$cate['id']))}{/if}
{if condition="$cate['cate_attr'] eq 3"}{$cate.link}{/if}'>{$cate.cate_name}</a> {if condition="$i neq count($pos)"}>{/if}
{/volist}
返回数据格式
array:2 [
0 => array:4 [
"id" => 9
"pid" => 0
"cate_name" => "帮助中心"
"cate_attr" => 1
]
1 => array:4 [
"id" => 12
"pid" => 9
"cate_name" => "web制作教程"
"cate_attr" => 1
]
]
使用方式
{$cates.cate_name}
返回数据
"id" => 2
"cate_name" => "相关文件"
"title" => ""
"keywords" => ""
"desc" => ""
"content" => ""
"status" => 1
"jump_id" => 0
"img" => ""
"cate_attr" => 1
"list_tmp" => "list_article.html"
"index_tmp" => "index_article.html"
"article_tmp" => "article_article.html"
"link" => ""
"sort" => 50
"model_id" => 1
"bottom_nav" => 0
"pid" => 0
"mark" => "news2"
"thumb" => 1
"uid" => 1
案例 volist循环显示文字所在父级栏目下的所有子栏目(注:只显示栏目中设置为显示在首页的栏目) 跳转栏目地址:{$vo.cate_attr|makeurl=###,$vo.id}
cate_attr
栏目属性$vo.id
栏目idmakeurl
后端封装函数用来判断跳转位置 判断当前所在栏目:{if condition="$vo.id eq $cid"}style=' color: #f00'{/if} 当前栏目名称:{$vo.cate_name} 顶级栏目名称:{$topCates.cate_name}
{$topCates.cate_name}
{volist name="sonCateRes" id="vo"}
<li>
<a href="{$vo.cate_attr|makeurl=###,$vo.id}" class="tag-link-5 " {if condition="$vo.id eq $cid"}style=' color: #f00'{/if} >
{$vo.cate_name}
</a>
</li>
{/volist}
返回数据格式
数组模式返回需要使用上门循环语句显示
0 => array:21 [
"id" => 9
"cate_name" => "帮助中心"
"title" => "" //栏目名称
"keywords" => ""//关键词
"desc" => ""//描述
"content" => ""//内容
"status" => 1//审核状态
"jump_id" => 0//是否跳转
"img" => ""//封面图
"cate_attr" => 1 //栏目类型 1列表页 2单页 3跳转 使用类型2【/index_tmp】类型 【list_tmp】【article_tmp】无效 ,使用类型3【/article_tmp】者【index_tmp】【index_tmp】无效
"list_tmp" => "list_article.html" //跳转列表页
"index_tmp" => "index_article.html" //单页地址
"article_tmp" => "article_article.html" //内容页
"link" => ""//类型3跳转页
"sort" => 50//栏目排序
"model_id" => 1
"bottom_nav" => 0//是否底部显示0显示1不显示
"pid" => 0//顶级栏目标识 0为顶级
"mark" => ""
"thumb" => 1
"uid" => 1
]
如果文章属于外链{:url('Article/index',array('aid'=>$vo['id']))}这种模式无法实现外部跳转 可使用一下两种方式进行判断 {$vo['attr']!= '2'?url('Article/index',array('aid'=>$vo['id'])):$vo['url']} 或 {$vo.id,$vo.attr,$vo.url|listurl=###} 注:传入数据格式固定
<ul class="row ">
{volist name="artRes" id="vo"}
<li>
<div class="neliTime">
<h3>{$vo.time|date="d"}</h3>
<p>{$vo.time|date="Y-m"}</p>
</div>
<a class="neliCon" href="{:url('Article/index',array('aid'=>$vo['id']))}">
<h3>{$vo.title}</h3>
<p>
{$vo.description|delhtml=###|cut_str="80"}
</p>
</a>
</li>
{/volist}
</ul>
<nav aria-label="Page navigation" class="page">
{$artRes|raw}
</nav>
返回数据
返回值为数组
["id" => 24 //文章id
"title" => "企业网站建设怎么做才合适" //文章名称
"keywords" => ""//文章关键词
"description" => "今天襄阳网站建设带大家了解下网站安全问题:怎么做合适企业网站?"//文章描述简介
"writer" => ""//作者
"source" => ""//来源
"url" => ""//外链跳转地址
"litpic" => 0//是否为图文
"attr" => 0//类型 0:图文 1图片集 2外部链接 3视频集 4资源下载
"click" => 0//点击次数
"content" => "<p><strong>小企业要功能简化</strong></p>"//内容
"imgres" => ""//图片及和视频集储藏字段
"model_id" => 0//文章类型
"time" => 1659332714//发文时间戳
"status" => 1//是否审核 0待审 1审核
"mes" => 1//是否可以留言 【未开启】
"attr_time" => 0 置顶状态
"markdown" => "ueditor"//使用编辑器类型
]