finecms全局常用标签

全局基础标签


网站标题:{$meta_title}

网站关键字:{$meta_keywords}

网站描述:{$meta_description}

网站seo标题:{$SITE_TITLE}

统计代码(后台网站设置添加):{$SITE_JS}

ICP号(后台网站设置添加):{$SITE_ICP}

网站底部:{$SITE_BOTTOM_INFO}

网站主题绝对路径:{SITE_THEME}

网站地址:{SITE_PATH}

公共调用模板:{template header}

扫描二维码关注公众号,回复: 4709371 查看本文章

首页列表标签


{list  catid=11 order=updatetime num=6 cache=36000}
<a href="{$t['url']}" title="{$t['title']}">{$t['title']}</a>
{strcut($t['description'],210)}
{/list}

头部栏目调用标签


1、不带二级栏目

{loop $cats $t}
{if $t['parentid']==0 && $t['ismenu']}
{php $arrchilds = @explode(',', $t['arrchilds']);}
<li {if isset($catid) && in_array($catid, $arrchilds)}style="color:red"{/if}><a href="{$t['url']}">{$t['catname']}</a></li>
{/if}
{/loop}

2、带二级栏目

{loop $cats $cat}
{if $cat[parentid] == 0 && $cat['ismenu']}
{$cat['catname']}
<ul class="sub">
 {if $cat['child']}
{loop $cats $a}
{if $a[parentid] == $cat[catid]}
<li><a href="{$a['url']}">{$a['catname']}</a></li>
 {/if}
 {/loop}
 {/if}
</ul>
 {/if}
 {/loop}

3、当前栏目的所有同级子栏目(带on)

{php $value=getCatNav($catid);}
{loop $value $c}
<li  {if $c['catid']==$catid}class="on"{/if}><a href="{$c['url']}">{$c['catname']}</a></li>
{/loop}

4、当前栏目的子栏目

{loop $cats $c}
{if $c['parentid']==$cats[$catid]['parentid']} 
<li><a href="{$c['url']}">{$c['catname']}</a></li>
{/if}
{/loop}

5、指定栏目名称及链接

栏目名称:{$cats[21][catname]}

栏目链接:{$cats[21]['url']}

 

列表页标签


路径导航{catpos($catid, ' &gt;&nbsp;')}

列表页的当前栏目名称:{$catname}

{list catid=$catid page=$page order=updatetime}
标题:{$t['title']}
缩略图:{thumb($t['thumb'])}
标题链接:{$t['url']}
描述:{$t['description']}
截取描述字数:{strcut($t['description'],210)}
时间:{date("Y-m-d", $t['updatetime'])}
{/list}

分页代码: {$pagelist}

分页样式配置文件:(/config/pagerule.ini.php)

strcut注释:{strcut($string, 长度, 截取后替代字符)}

获取当前栏目的子栏目

{php $value=getCatNav($catid);}

{loop $value $c}

 <li  {if $c['catid']==$catid}class="on"{/if}><a href="{$c['url']}">{$c['catname']}</a></li>

{/loop}

内容页标签


内容页的当前栏目名称:{$cat[catname]} 

内容:{$content}

标题:{$title}

时间:{date("Y.m.d", $updatetime)}

点击次数:<script type="text/javascript" src="{url('api/hits',array('id'=>$id, 'hits'=>$hits))}"></script>

内容页分页:

{if $contentpage}
{loop $contentpage $i=>$u}
<a{if $page!=$i} href="{$u}"{/if}>{$i}</a>
{/loop}
{/if}

上一篇,下一篇:

{if $prev_page}上一篇:<a href="{$prev_page['url']}">{$prev_page['title']}</a>{/if} <br/>{if $next_page}下一篇:<a href="{$next_page['url']}">{$next_page['title']}</a>{/if}

打印,关闭,收藏,返回:

<a onclick="window.print()" href="#">[打印本页]</a>
<a href ="#"  onClick="jscript:window.external.AddFavorite(document.location.href,document.title);">[收藏本页]</a>
<a href="javascript:window.close();">[关闭本页]</a>
<a href ="#"  onclick="javascript:history.back(-1);">[返回上一页]</a>

列表页筛选标签


筛选标签:

按使用功能:{php $catid = array('全部'=>'4','卧室系列'=>'5','客厅系列'=>'6','餐厅系列'=>'7','茶台系列'=>'8','办公系列'=>'9');}
{loop $catid $k=>$t}<a href="{list_url($param, 'catid', $t)}" {if $param['catid']==$t}class="onc"{/if}>{$k}</a>{/loop}

按红木材质:{php $cz = array('不分材质'=>'','花梨木'=>'花梨木','红酸枝'=>'红酸枝','黑酸枝'=>'黑酸枝');}
{loop $cz $k=>$t}<a href="{list_url($param, 'cz', $t)}" {if $param['cz']==$t}class="onc"{/if}>{$k}</a>{/loop}

筛选列表:

{php $rule = list_url($param, 'page', '[page]');}
{list catid=$catid cz=$param[cz] catid=$param[catid]   page=$page pagesize=$pagesize urlrule=$rule order=updatetime more=1} 
自定义标签:{$t['字段名称']}  
标题:{$t['title']}
缩略图:{thumb($t['thumb'])}
标题链接:{$t['url']}
描述:{$t['description']}
截取描述字数:{strcut($t['description'],210)}
时间:{date("Y-m-d", $t['updatetime'])}
{/list}

筛选需要自定义函数:

<?php
//自定义URL函数,网站上线后请将函数放在自定义函数库文件中,就可以随便更改url规则
function list_url($param, $name=NULL, $value=NULL) {
    unset($param['page']);
    if (!is_null($name) && !is_null($value)) {
        $param[$name] = $value;
    } elseif (!is_null($name) && is_null($value)) {
        unset($param[$name]);
    }
    $url  = url('content/list', $param);//动态地址
    return $url;
}
?>

表单类标签


预约类:

<form action="{url('form/post', array('modelid'=>3))}" method="post" onsubmit="return check(this)">
输入框:<input type="text" name="data[weixin]" id="weixin" placeholder="微信" />
提交:<input type="submit" class="submit" value="立刻预约" name="submit">
验证码:
{if $code}<input name="code" type="text"/><img src="{url('api/captcha', array('width'=>80,'height'=>25))}">{/if}
</form>

留言类:

{list table=gbook.gbook catid=$catid page=$page pagesize=5 order=addtime_desc }
用户名:{$t['name']}
时间:{date("Y-m-d", $t['addtime'])}
内容:{$t['content']}
{if $t['status']==1}   //判断审核状态
管理员回复:{$t['r_content']}
{/if}
{/list}

分页代码:{$pagelist}

TAG标签


案例:红木手串网彩色TAG调用函数在function.php里增加getTagStyle()

{list action=tag num=20}
<span style="{getTagStyle()}"><a href="{$t[url]}" title="{$t[name]}">{$t['name']}</a></span>
{/list}

友情链接标签


{list table=link.link order=listorder_asc num=10}
图片类
{if $t['logo']}
<a href="{$t['url']}" target="_blank" title="{$t['introduce']}"><img src="{$t['logo']}"></a>
{else}
{/if}
文字类
{if $t['logo']}
{else}
<a href="{$t['url']}" target="_blank" title="{$t['introduce']}">{$t['name']}</a>
{/if}
{/list}

 

功能性标签


1、每隔5条信息一条横线

{if ($key+1)%5==0}<div style="border-bottom:1px solid #e8e8e8;margin:20px 0;"/></div>{/if}

2、最新日期加标签

<font {if date('Y-m-d', $t['updatetime']) == date('Y-m-d')}style="color:red"{/if}>

3、计数排行榜:{$key+1}

4、首页列表页分页

{php $page=(int)$_GET['page'] ? (int)$_GET['page'] : 1;}
{list modelid=1 INcatid=2,3,4,5 page=$page pagesize=5 urlrule=index.php?page=[page] order=updatetime}
标题:{$t['title']}
缩略图:{thumb($t['thumb'])}
标题链接:{$t['url']}
描述:{$t['description']}
截取描述字数:{strcut($t['description'],210)}
时间:{date("Y-m-d", $t['updatetime'])}  
{/list} 
{$pagelist}

5、伪静态设置

修改config/router.ini.php,后台设置tag配置tag-{tag}.html

//tag伪静态/

'^page([0-9]+).html$'                 => 'index.php?page=${1}',

'^tag-([a-zA-Z0-9]+).html$'           => 'c=tag&a=list&kw=${1}',

6、修改远程下载图片的路径问题(修复编辑器下载后路径)

修改models/ContentModel.php里,搜索download_images函数

猜你喜欢

转载自www.cnblogs.com/hm21/p/10198978.html