Z-Blog Wiki Z-Blog Wiki

Z-blog official library

User tools

Site tools


zblogphp:development:plugins:mip

MIP theme development guide

Type selection

You can choose to develop the following two types of MIP topics.

General themes

Common theme, that is, the theme that can be switched directly in the background. After your topic depends on this plug-in, you can directly use MIP related functions by referring to the following code directly.

Independent theme

After the MIP plug-in is enabled, there will be a subdirectory of / MIP / by default, with its own theme. The theme here has nothing to do with the theme set in the background. Independent theme, that is to set the theme here.

After creating a plug-in in in the background, create the template directory, and insert the following code in include.php (for example only, pay attention to changing the application ID to your own application ID)

 <? php
 #Register plug-ins RegisterPlugin ( "App ID" , "Activeplugin? App ID" ) ;   function ActivePlugin_ Application ID ( )  { Add_ Filter_ Plugin ( 'Filter_ Plugin_ MIP_ Template' ,  'app ID_ MIP_ Template' ) ;
 }   function Application ID_ MIP_ Template ( & $template )  {
   $files  = GetFilesInDir ( dirname ( __ FILE__ )  .  '/template' ,  'php' ) ;
   foreach  ( $files  as  $sortname  =>  $fullname )  {
       $template -> templates [ $sortname ]  =  file_ get_ contents ( $fullname ) ;
   }
 }   function InstallPlugin_ Application ID ( )  { }
 function UninstallPlugin_ Application ID ( )  { }

The structure is as follows:

You can then develop MIP themes just as you would with a normal theme. For example, see: https://app.zblogcn.com/mip/

General development guide

Your theme must first rely on the MIP plug-in. To enable MIP within your theme, please follow the following methods:

1. Activeplugin in your theme_ Topic ID function, inserting

 mip_ active ( ) ;
2. In the header.php inside your topic, insert
 < meta  name = "bloghost"  content = "{$host}" >
3. If your topic does not have < style MIP custom >, insert it in header.php
 < style mip-custom> {$mipstyle} < / style >
If you have < style MIP custom >, insert {$mipstyle} before < / style >.

4. At this point, you can use the functions provided by the MIP plug-in.

comment

1. Replace {template: comments} in the topic with

 <mip-zblogphp-comment post- id = "{$article.ID}" >< / mip-zblogphp-comment>
2. In the theme's footer PHP insert
 < script  src = " https://c.mipcdn.com/static/v1/mip-zblogphp-comment/mip-zblogphp-comment.js " >< / script >
3. (optional) copy the components / comment / mip-comment.php in the MIP plug-in to your own topic for development.

Visits

1. Change the '{$article. Viewnums}' in the article list to

 <mip-zblogphp-article-viewnum post- id = "{$article.ID}" default = "{$article.ViewNums}" update = "0" >< / mip-zblogphp-article-viewnum>
2. Change the '{$article. Viewnums}' in the article page to
 <mip-zblogphp-article-viewnum post- id = "{$article.ID}" default = "{$article.ViewNums}" update = "1" >< / mip-zblogphp-article-viewnum>
3. In the theme's footer PHP insert
 < script  src = " https://c.mipcdn.com/static/v1/mip-zblogphp-article-viewnum/mip-zblogphp-article-viewnum.js " >< / script >

zblogphp/development/plugins/mip.txt ·Last modified: 2018 / 05 / 09 13:04 by Endless beacon smoke