O plug-in Z-blogPHP usa if $type para julgar páginas, implementando a inserção de conteúdo diferente em páginas diferentes.

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

Não gosto.1

Link para este artigo:https://pt.finchui.com/zblog-course/19.html

Comentários dos internautas

Eu acho que você gosta.

Mercadorias populares
Artigos populares
Rótulos quentes
Rótulos relevantes
Edição da FinchUI Store Região Especial Preferencial de Hong Kong

Compartilhamento

Copia do link

Estúdio Lan XingAdicione um amigo

Horário de trabalho: 9: 00 - 22: 00
Sábado, domingo: 14: 00 - 22: 00
wechat
Digitalizar código para adicionar WeChat de atendimento ao cliente