Z-blogPHP插件使用if $type判斷頁面,實現在不同的頁面插入不同的内容

Z-blogPHP插件實現在不同的頁面插入不同的内容!

换個說法就是,Z-blogPHP插件實現在指定的頁面插入内容!


1、Z-blog PHP插件在首頁和列表頁插入内容

接口寫法:

PHP
Add_Filter_Plugin('Filter_Plugin_ViewList_Core','插件ID_ViewList_Core');//在首页和列表页生效

插入内容寫法:

PHP
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插件在详情頁插入内容

接口寫法:

PHP
Add_Filter_Plugin('Filter_Plugin_ViewPost_Template','插件ID_ViewPost_Template'); //详情页

插入内容寫法:

PHP
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插件在搜索頁插入内容

接口寫法:

PHP
Add_Filter_Plugin('Filter_Plugin_ViewSearch_Template','插件ID_ViewSearch_Template'); //搜索页

插入内容寫法:

PHP
function 插件ID_ViewSearch_Template(&$template) {global $zbp;}


應用實例:

下述插件使用if $type判斷實現不同的頁面插入不同的内容。

image.png

不喜歡1

本文链接:https://zh-tw.finchui.com/zblog-course/19.html

网友評論

猜你喜歡

熱門商品
熱門文章
熱門標簽
相關標簽
FinchUI商店版 香港特惠專區

分享

復制链接

星岚工作室添加好友

上班時间:9:00-22:00
周六、周日:14:00-22:00
wechat
扫码添加客服微信