您的位置 首页 php技术

fastadmin cms常用标签

常用模板调用 {include file=”common/top” /} //导航 {include file…

常用模板调用

{include file="common/top" /} //导航
{include file="common/mbx" /} //面包屑
{include file="common/foot" /} //页尾

面包屑及栏目名称图片

{cms:channel name="name" /}
{cms:channel name="image" /}
{cms:breadcrumb id="item" key="k"}
    {if $k>1}/{/if}<a title="{$item.name}" href="{$item.url}">{$item.name}</a>
{/cms:breadcrumb}

css/jss等文件引入

<script type="text/javascript" src="__CDN__/js/jquery.js?v={$site.version}"></script>
<link rel="stylesheet" type="text/css" href="__CDN__/css/pc.css?v={$site.version}">

网站导航三级目录

<ul class="qc">
    {cms:channellist id="nav" type="top" cache="0" }
        <li>
            <a class="{if $nav->is_active}this{/if}" href="{$nav.url}">{$nav.name}</a>
            {if $nav.has_child}
            <ul>
                {cms:channellist id="son" type="son" typeid="nav['id']" cache="0" }
                <li><a class="{if $son->is_active}this{/if}"  href="{$son.url}">{$son.name}</a>
                     {if $son.has_child}
                     <ul>
                        {cms:channellist id="sons" type="son" typeid="son['id']" cache="0" }
                        <li><a class="{if $sons->is_active}this{/if}"  href="{$sons.url}">{$sons.name}</a></li>
                        {/cms:channellist}
                    </ul>
                    {/if}
                </li>
                {/cms:channellist}
            </ul>
            {/if}
        </li>
    {/cms:channellist}
</ul> 

栏目

id:循环变量名
key:循环索引名
row:行数
limit:行数
empty:为空时显示的信息
mod:取模基数,常用于控制多少条数据后换行、变色等
cache:缓存时间,为0则不缓存,为true则永久缓存
orderby:排序字段,支持id,createtime,updatetime,rand(随机),weigh(权重)
orderway:排序方式,asc=正序,desc=倒序
imgwidth:图片宽度
imgheight:图片高度
condition:筛选条件,可使用SQL字段筛选
model:模型ID
field:调用字段,默认为*
type:指定类型,top=顶级栏目,brother=兄弟栏目,son=子栏目,sons=子孙栏目
typeid:指定类型关联的ID,如果type为空,这里可指定栏目的ID集合

{cms:channellist id="channel" type="son" typeid="栏目id"}
        {$channel.url}
        {$channel.name}
        {$channel.images}
        {$channel.description}
{/cms:channellist}

栏目及当前栏目下产品

{cms:channellist id="channel" type="son" typeid="栏目id"}
<dl>
    <dt><a class="{if $channel->is_active}this{/if}" href="{$channel.url}" title="{$channel.name}">{$channel.name}</a></dt>
    <dd>
        {cms:arclist id="item" row="10"   orderway="desc" channel="channel['id']"}
        <a class="{if @$__ARCHIVES__.id eq $item.id}this{/if}" href="{$item.url}" title="{$item.title}">{$item.title}</a>
        {/cms:arclist} 
    </dd>
</dl>
{/cms:channellist}

区块字段

{cms:block name="email" field="url" /}  

区块列表

{cms:blocklist id="block" name="" orderby="weigh" orderway="desc" } 
{$block.image}
{$block.title}
{$block.content}
{:str_replace(["<p>","</p>"], "", $block.content)}//区块内容去除标签
{volist name="$block.images|explode=',',###" id="image"}
           {notempty name="$block.images"}{$image|cdnurl}{$block.intro[$key]}{/notempty}
{/volist}
{/cms:blocklist}

文章列表

 {cms:pagelist id="item"}
 {$item.url}
 {$item.title}
 {$item.image}
 {$item.description}
 {:date('Y-m-d', $item.publishtime)}
 {/cms:pagelist}

文章详情

{cms:archives name="content" /}
文章详情数组字段渲染
{volist name=":json_decode($__ARCHIVES__.listtxt,true)" id="item"}
{$item.title}
{$item.intro}
{/volist}
文章详情图集加描述
{volist name="$__ARCHIVES__.images|explode=',',###" id="image"}
{$image|cdnurl}
{$__ARCHIVES__.intro[$key]}                          
{/volist}
文章分页
{cms:pageinfo type="full" /}
文章上下篇
 {cms:prevnext id="prev" type="prev" archives="$__ARCHIVES__.id" channel="$__CHANNEL__.id"}
    <a href="{$prev.url}" class="fl">上一篇:{$prev.title}</a>
    {/cms:prevnext}
    {cms:prevnext id="next" type="next" archives="$__ARCHIVES__.id" channel="$__CHANNEL__.id"}
    <a href="{$next.url}" class="fr">下一篇:{$next.title}</a>
{/cms:prevnext}

相关产品(取的当前分类下剩余产品)

{cms:arclist id="item" row="3"  channel="__CHANNEL__.id" orderby="weigh" orderway="desc" cache="0" condition="`id` != $__ARCHIVES__->id" }
     
     {$item.url}
     {$item.title}
     {$item.image}
  
 {/cms:arclist}

相关文章 (取的同tags文章)

{cms:arclist id="relate" model="$__ARCHIVES__.model_id"  row="6"   cache="0" tags="__ARCHIVES__.tags" condition="`id` != $__ARCHIVES__->id"}
                {if condition="$relate.id neq $__ARCHIVES__.id"}
                   <a href="{$relate.url}" title="{$relate.title}">
                        <h3>{$relate.title}</h3>
                     </a>
                {/if}
{/cms:arclist}

搜索

<form action="/s.html" method="post">
         <input autocomplete = "off" class="form-control" name="q" data-suggestion-url="/addons/cms/search/suggestion.html" type="text" value="" placeholder="Key words">
         <button><i class="ico icon-sousuo1"></i></button>
</form>

搜索结果列表 search.html

{cms:pagelist id="item"}
      {$item.url}
      {$item.title}
      {$item.image}
      {$item.description}
      {:date('Y-m-d', $item.publishtime)}
{/cms:pagelist}

判断

{empty name="name"}
name为空
{else /}
name不为空
{/empty}

{notempty name="name"}
name不为空
{/notempty}

{notempty name="$__ARCHIVES__.images"}
{/notempty}

{switch name="变量" }
    {case value="值1" break="0或1"}输出内容1{/case}
    {case value="值2"}输出内容2{/case}
    {default /}默认情况
{/switch}

表单提交 /d/customer/post.html 【customer】为表单名称

<form onsubmit="return $('.formPoint').show();" method="POST" action="/d/customer/post.html">
    <input type="hidden" name="__diyname__" value="customer">
    {:token()}
    <input name="row[name]" type="text" placeholder="*Name :" required=""></input>
    <input name="row[email]" type="Email" placeholder="*Email :" required=""></input>
    <textarea name="row[content]" type="text" placeholder="*Message:" required=""></textarea>
    <button type="submit">SEND</button>
</form>

文章关联产品

{cms:arclist id="product" model="1" condition="`industies_add` like '%$__ARCHIVES__->id%'" row="10" addon="industies_add"}
{/cms:arclist}
industies_add为关联字段名称

1.jpg

首页调用最新文章或者产品

id:循环变量名
key:循环索引名
row:行数
limit:行数
empty:为空时显示的信息
mod:取模基数,常用于控制多少条数据后换行、变色等
cache:缓存时间,为0则不缓存,为true则永久缓存
orderby:排序字段,支持id,createtime,updatetime,rand(随机),weigh(权重),views(浏览次数)
orderway:排序方式,asc=正序,desc=倒序
imgwidth:图片宽度
imgheight:图片高度
condition:筛选条件,可使用SQL字段筛选
model:模型ID
channel:栏目ID或栏目ID集合
tags:标签
addon:副本字段集,如果为true则表示所有副表字段,多个字段以,进行分隔
field:调用字段,默认为*
flag:标志 top

{cms:arclist id="news" model="1"  row="6" orderby="updatetime"} 
        {$news.url}
        {$news.image}
        {$news.title}
        {:date('Y-m-d', $news.publishtime)}
{/cms:arclist}

条件筛选

{cms:pagefilter id="filter" key="index" exclude=""}
     <dl class="dl{$index}">
          <dt>{$filter.title}:</dt>
          <dd>
               {volist name="$filter.content" id="item"}
               <a href="{$item.url}" class="{$item.active?'active':''}" href=""><span><i class="ico icon-choice2"></i></span> {$item.title}</a>
               {/volist}
               <select onchange="window.location=this.value;">
            {volist name="$filter.content" id="item"}
            <option {$item.active?'selected':''} value="{$item.url}">{$item.title}</option>
            {/volist}
               </select>
          </dd>
     </dl>
{/cms:pagefilter}

1.jpg

{cms:paramelist name="$title" id="vo"}
    <!--参数标题-->
    <h4>{$vo.title}</h4>
    <!--判断参数类型 1为编辑器 2为图集 3为视频链接 4为文件-->
    {if $vo.text_type == 1}
    <!--编辑器内容-->
    <p>{$vo.content}</p>
    {elseif $vo.text_type == 2/}
    <!--图集-->
    {volist name="$vo.imagearr" id="img" key="k"}
    <img src="{$img}" alt="{$vo.imgdesc[$k-1]}">
    {/volist}
    {elseif $vo.text_type == 3/}
    <!--视频-->
    <video src="{$vo.video}"></video>
    {elseif $vo.text_type == 4/}
    <!--文件-->
    <input type="file" value="{$vo.file}" />
    {/if}
{/cms:paramelist}
<div class="productLeft">
    {cms:channellist id="channel" type="son" typeid="29"}
    <dl>
      <dt><a class="{if $channel->is_active}this{/if}" href="{$channel.url}" title=" {$channel.name}"> {$channel.name}</a></dt>
      {if $channel.has_child}
      <dd>
      {cms:channellist id="channel" type="son" typeid="channel['id']"}
        <a class="{if $channel->is_active}this{/if}" href="{$channel.url}" title="{$channel.name}">{$channel.name}</a>
       {/cms:channellist}
      </dd>
      {/if}
       
    </dl>
    {/cms:channellist}
</div>
本文来自网络,不代表MuKe网站资源立场,转载请注明出处:https://www.somke.cn/archives/54

作者: delon

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

联系我们

联系我们

在线咨询: QQ交谈

邮箱: lon_mail@qq.com

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部