Z-blogPHP插件使用if $type判断页面,实现在不同的页面插入不同的内容
Z-blogPHP插件实现在不同的页面插入不同的内容!
换个说法就是,Z-blogPHP插件实现在指定的页面插入内容!
1、Z-blog PHP插件在首页和列表页插入内容
接口写法:
Add_Filter_Plugin('Filter_Plugin_ViewList_Core','插件ID_ViewList_Core');//在首页和列表页生效插入内容写法:
function 插件ID_ViewList_Core(&$type)
{global $zbp;if ($type=='index'){}//判断首页
if ($type=='category'){}//判断分类页
if ($type=='TAG'){}//判断标签页
if ($type=='author'){}//判断作者页
if ($type=='date'){}//判断日期页}2、Z-blog PHP插件在详情页插入内容
接口写法:
Add_Filter_Plugin('Filter_Plugin_ViewPost_Template','插件ID_ViewPost_Template'); //详情页插入内容写法:
function 插件ID_ViewPost_Template(&$template) { global $zbp;
$article = $template->GetTags('article');
if ($type = $template->GetTags('type') =='article'){}//判断文章页(article)
if ($type = $template->GetTags('type') =='page'){}//判断页面(page)}3、Z-blog PHP插件在搜索页插入内容
接口写法:
Add_Filter_Plugin('Filter_Plugin_ViewSearch_Template','插件ID_ViewSearch_Template'); //搜索页插入内容写法:
function 插件ID_ViewSearch_Template(&$template) {global $zbp;}信息由用户投稿以及用户自行发布,真实性、合法性由发布人负责,涉及到汇款等个人财产或隐私内容时请仔细甄别,注意防骗!如有侵权,请联系:wwwlaoyuwang#126.com(#=@)!我们会第一时间核实处理!
上一篇