zblog教程 内容:90

Zblog开发者必备PHP标签大全

  • 查看作者
  • zblog开发者在开发模板过程中,需要用到大量的标签函数变量,不可能全部记得住,因此我为各位开发者梳理了如下标签:

    分类标签

    标签描述
    {$article.ID} 分类ID
    {$category.Name}分类名称
    {$category.Alias}分类别名
    {$category.Url}分类链接
    {$category.Count}分类文章数
    {$category.Intro}分类摘要
    {$category.Order}分类序号
    {$category.Level}分类层级
    {$category.RootID}分类顶级ID
    {$category.ParentID}分类上级ID
    {$category.Parent}上一级类实例
    {$category.SubCategorys}子分类数组
    {$category.Template}分类所用模板
    {$category.LogTemplate}分类文章模板
    {$category.Metas.XXX}分类扩展数据

    分页标签

    标签描述
    {$pagebar.PageBarCount}

    分页长度

    {$pagebar.PageCount}

    每页文章数量

    {$pagebar.Name}

    分页名称

    {$pagebar.PageAll}

    总页码数

    {$pagebar.PageNow}

    当前页码

    {$pagebar.PageFirst}

    起始页码

    {$pagebar.PageLast}

    尾页页码

    {$pagebar.PagePrevious}

    上一页ID

    {$pagebar.PageNext}

    下一页ID

    {$pagebar.prevbutton}

    上一页URL

    {$pagebar.nextbutton}

    下一页URL

    {$pagebar.buttons}

    页码关联数组

    时间标签

    标签描述
    {$article.Time('Y年m月d日')}

    年月日

    {$article.Time('H:i:s')}

    时分秒

    用户标签

    标签描述
    {$author.Url}

    用户URL

    {$author.Name}

    用户名

    {$author.Alias}

    用户别名

    {$author.StaticName}

    用户静态名

    {$author.Level}

    用户级别

    {$author.LevelName}

    用户级别名

    {$author.Email}

    用户邮箱

    {$author.HomePage}

    用户主页

    {$author.Intro}

    用户摘要

    {$author.Avatar}

    用户头像

    {$author.Articles}

    用户文章数

    {$author.Pages}

    用户页面数

    {$author.Comments}

    用户评论数

    {$author.Uploads}

    用户附件数

    TAGS标签

    标签描述
    {foreach $article.Tags as $tag}<a href="{$tag.Url}" title="{$tag.Name}">{$tag.Name}</a>{/foreach}调用TAGS
    {$tag.Name}

    tags名称

    {$tag.Url}

    tags链接

    {$tag.Count}

    标签下文章数

    {$tag.Metas.XXX}

    标签扩展数据

    其他辅助

    标签描述
    <a href="{$host}zb_system/cmd.php?act=ArticleEdt&id={$article.ID}" target="_blank">编辑</a>

    编辑当前文章

    <a href="javascript:if(confirm('此操作无法恢复,确定要删除吗?')) location.href='{$host}zb_system/cmd.php?act=ArticleDel&id={$article.ID}&csrfToken={$zbp.GetToken()}'" target="_blank">删除</a>

    删除当前文章

    {php}$subtitle = preg_replace('/[\r\n\s]+/', '', trim(SubStrUTF8(TransferHTML($article->Intro,'[nohtml]'),100)));{/php}{$subtitle}

    无样式摘要

    {* Template Name:模板说明(默认模板) *}

    模板说明

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <meta name="renderer" content="webkit">

    响应式代码

    {$zbp->GetTagByID(1)->Url}

    指定TagURL

    {$zbp->categories[1]->Url}

    指定分类URL

    {$zbp->GetPostByID(1)->article.Prev.Url}

    指定ID上下篇

    文章标签

    标签描述
    {$article.ID}

    文章ID

    {$article.Title}

    文章标题

    {$article.IsTop}

    文章是否置顶

    {$article.Intro}文章摘要
    {$article.Content}

    文章正文

    {$article.Url}

    文章链接

    {$article.Status}文章状态
    {$article.IsLock}

    是否禁止评论

    {$article.CommNums}

    文章评论数

    {$article.ViewNums}文章浏览数
    {$article.Time('Y年m月d日')}

    文章发布时间

    {$article.Category.XXX}

    文章分类数据

    {$article.Author.XXX}

    文章作者数据

    {$article.Tags.XXX}

    文章标签数组

    {$article.Prev.Url}

    上一篇URL

    {$article.Next.Url}

    下一篇URL

    {$article.Prev.Title}

    上一篇标题

    {$article.Next.Title}

    下一篇标题

    {$article.Type}

    文章类型

    {$article.Metas.XXX}

    文章扩展

    {$article.Author.Metas.XXX}

    文章作者扩展

    评论标签

    标签描述

    <label id='AjaxCommentBegin'></label>

    {foreach $comments as $key => $comment}

    {template:comment}

    {/foreach}

    <div class='pagebar commentpagebar'>

    {template:pagebar}

    </div>

    <label id='AjaxCommentEnd'></label>

    调用评论

    {$comment.ID}

    评论ID

    {$comment.FloorID}评论楼号
    {$comment.Level}

    评论层级

    {$comment.ParentID}评论父ID
    {$comment.RootID}

    评论根ID

    {$comment.LogID}

    评论文章ID

    {$comment.Post.Url}

    评论文章URL

    {$comment.Post.Title}

    评论文章标题

    {$comment.Author.Name}

    评论作者

    {$comment.Author.HomePage}

    评论者网址

    {$comment.Author.Email}

    评论者邮箱

    {$comment.Author.Avatar}

    评论者头像

    {$comment.Content}

    评论正文

    {$comment.IP}

    评论者IP

    {$comment.Time('Y年m月d日')}

    评论时间

    {$comment.Agent}

    评论客户端

    模块标签

    标签描述
    {template:sidebar}

    调用侧栏

    {module:moduleName}

    单独调用模块

    {module:navbar}

    导航栏

    {module:calendar}

    日历

    {module:controlpanel}

    控制面板

    {module:catalog}网站分类
    {module:searchpanel}搜索
    {module:comments}最新留言
    {module:archives}

    文章归档

    {module:statistics}站点信息
    {module:favorite}

    网站收藏

    {module:link}

    友情链接

    {module:misc}

    图标汇集

    {module:authors}

    作者列表

    {module:previous}

    最近发表

    {module:tags}

    tags列表

    模块扩展

    标签描述
    {$modulesbyfilename['moduleFileName'].ID}模块内部ID
    {$modulesbyfilename['moduleFileName'].Name}模块名称
    {$modulesbyfilename['moduleFileName'].FileName}文件名
    {$modulesbyfilename['moduleFileName'].Content}模块内容
    {$modules['moduleFileName'].HtmlID}htmID
    {$modulesbyfilename['moduleFileName'].Type}模块类型
    {$modules['moduleFileName'].MaxLi}模块最大列数
    {$modulesbyfilename['moduleFileName'].Source}模块属性
    {$modules['moduleFileName'].IsHideTitle}是否隐藏标题

    系统标签

    标签描述
    {$host}博客网址
    {$name}博客标题
    {$theme}主题名称
    {$style}样式名称
    {$header}页头变量
    {$user}当前登录用户
    {$zblogphp}ZBP版本
    {$subname}博客副标题
    {$host}zb_users/theme/{$theme}/script/脚本路径
    {$feedurl}RSS订阅
    {$footer}页尾变量
    {$socialcomment}社会化评论区
    {$zblogphpabbrhtml}版本Abbr
    {$host}zb_system/login.php网站管理
    {$host}zb_users/theme/{$theme}/style/images/图片路径
    当前位置:<a href="{$host}">首页</a> - {$title}分类地图
    {$type}页面类型
    {$cookiespath}Cookie路径
    {$copyright}版权说明
    {$language}网站语言
    {$host}zb_users/theme/{$theme}/style/style.cssCSS路径
    当前位置:<a href="{$host}">首页</a> - <a href="{$article.Category.Url}" class="cata">{$article.Category.Name}</a> - {$article.Title}文章地图
    {$page}页面页码
    {$path}网站物理路径

    插件开发

    标签描述
    Add_Filter_Plugin('API名称','执行代码(函数)');插件挂钩方式
    RegisterPlugin("插件ID","ActivePlugin_插件ID");注册插件

    function ActivePlugin_插件ID() {

      Add_Filter_Plugin('API名称','执行代码(函数)');

    }

    接口挂接函数

    function InstallPlugin_插件ID(){}

    function UninstallPlugin_插件ID(){}

    插件激活与禁用的执行函数
    if (!$zbp->CheckPlugin('插件ID')) {$zbp->ShowError(48);die();判断插件状态

    $zbp->Config('插件ID')->选项参数=选项值;

    $zbp->SaveConfig('插件ID');

    设置并保存配置选项
    $s=$zbp->Config('插件ID')->选项参数;读取配置选项
    $zbp->HasConfig('插件ID');判断配置选项是否已创建
    $zbp->Config('插件ID')->HasKey('选项参数');判断配置选项某一键值是否存在
    $zbp->DelConfig('插件ID');删除配置

    $article->Metas->选项参数=选项值;

    $article->Save();

    设置并保存自定义域选项
    $s=$article->Metas->选项参数;读取自定义域选项
    $article->Metas->Del('选项参数');删除自定义域

    #表名

    $table['plugin_插件ID'] = 'plugin_插件ID';

    #表结构

    $datainfo['plugin_插件ID'] = array(

    'ID' => array('ds_ID','integer','',0),

    'key' => array('ds_key','string',128,''),

    'cmtid' => array('ds_cmtid','integer','',0)

    );

    #全局声明

    global $zbp;

    #判断是否已创建,否则新建数据表

    if(!$zbp->db->ExistTable($GLOBALS['table']['plugin_插件ID']))

    {

    $s = $zbp->db->sql->CreateTable($GLOBALS['table']['plugin_插件ID'],$GLOBALS['datainfo']['plugin_插件ID']);

    $zbp->db->QueryMulit($s);

    }

    自定义数据表

    //挂接口:

    Add_Filter_Plugin('Filter_Plugin_Zbp_Load','tstore_Refresh');

    //方法:

    function tstore_Refresh(){

    global $zbp;

    if ($zbp->option['ZC_DEBUG_MODE']) {

    $zbp->BuildTemplate();

    }

    }

    模板开发实时刷新
    <

    //判断移动端,正式使用时请添加应用前缀,如:AppID_Theme_mobile()

    function Theme_mobile(){

    global $zbp;

    $is_mobile = false;

    $regex = '/android|adr|iphone|ipad|linux|windows\sphone|kindle|gt\-p|gt\-n|rim\stablet|opera|meego|Mobile|Silk|BlackBerry|Opera\Mini/i';

    if (preg_match($regex, GetVars('HTTP_USER_AGENT', 'SERVER'))) $is_mobile = true;

    return $is_mobile;

    }

    前端判断:

    {if !Theme_mobile()}

    {template:index} //PC

    {elseif Theme_mobile()}

    {template:m_index} //移动端

    {/if}

    判断移动端

    请登录之后再进行评论

    登录
    最新评论
    0U币
    已有1876人浏览, 浏览收益0, 礼物收益0, 打赏收益0, 点赞收益0, 广告收益0, 获得总收益0U币
    也可开通会员全场文章免费看
    免费教程