Chapter 4: Plug-in function functions

Release time:2017年08月08日 Author:Catfish CMS Reading volume:82378

In the previous chapter  we learned how to create a basic plug-in file, and know the basic  structure of the plug-in code, but also know where the plug-in  background code should be placed, Show information to the page, such as the announcement plug-in will be posted to the home page.


We use the bulletin plugin as an example, to see how to do in the home page shows the announcement.


Notice plug-in uses a function function "home_top" to output the announcement content to the home page. The code is as follows


    public function home_top(&$params)
    {
        //执行代码,输出到首页顶部
        $data = 'html代码';
        $this->add($params,'home_top',$data);//将公告内容追加到“home_top”
    }

Note: The red part must be the same!


The function code for the  function "home_top" is very simple. There are only two lines of code.  The first line puts the html code at the top of the home page into the $  data variable. The second line appends the contents of the announcement  to "home_top". Add the contents of the code is a  built-in function $ this-> add, this function has three parameters,  the first is the incoming system parameters, this parameter can be  copied as long as the second parameter is the function name, here is the  " Home_top "; The third parameter is the $ data variable, which stores the html code to be displayed.


Is not very  simple, as long as two lines of code can be written, in fact, you just  write html code on the line, the second line of code only need to copy  over.


The following functions provided by these systems can be used in this way to use


top:全站顶部
mid:全站中间
bottom:全站底部

home_top:首页顶部
home_mid:首页中间
home_bottom:首页底部

article_list_top:文章列表顶部
article_list_mid:文章列表中部
article_list_bottom:文章列表底部

article_top:文章顶部
article_mid:文章中部
article_bottom:文章底部

category_top:分类顶部
category_mid:分类中部
category_bottom:分类底部

page_top:页面顶部
page_mid:页面中部
page_bottom:页面底部

search_top:搜索顶部
search_mid:搜索中部
search_bottom:搜索底部

side_top:边栏顶部
side_mid:边栏中间
side_bottom:边栏底部

home_side_top:首页边栏顶部
home_side_mid:首页边栏中间
home_side_bottom:首页边栏底部

article_side_top:文章边栏顶部
article_side_mid:文章边栏中间
article_side_bottom:文章边栏底部

article_list_side_top:文章列表边栏顶部
article_list_side_mid:文章列表边栏中间
article_list_side_bottom:文章列表边栏底部

category_side_top:分类边栏顶部
category_side_mid:分类边栏中间
category_side_bottom:分类边栏底部

page_side_top:页面边栏顶部
page_side_mid:页面边栏中间
page_side_bottom:页面边栏底部

search_side_top:搜索边栏顶部
search_side_mid:搜索边栏中间
search_side_bottom:搜索边栏底部

comment_top:评论顶部
comment_mid:评论中间
comment_bottom:评论底部

Well, up to now, you can add the content you want to add anywhere on your site, and it's important to write code that's simple.


With these  functions, we also need some built-in functions to help us to work more  simple, just like $ this-> add this built-in function, we can copy as  long as you can use^_^


We'll learn about several built-in functions in the next chapter.


Go to the next chapter


Original article, reproduced please specify:Chapter 4: Plug-in function functions | Catfish(鲶鱼) CMS

Reward

I want to comment Sign in to post a comment


Latest release

鲶鱼系统如何实现独立显示联动二级菜单

我们在做主题的时候,有时需要在页面单独显示当前菜单下的二级菜单,这个在鲶鱼系统里面有两种...

鲶鱼CMS绿色集成环境PHP5.6版

由于PHP软件的运行都需要服务器运行环境,虽然可以找到很多PHP的集成环境来使用,但是多...

鲶鱼Blog的归档标签怎么使用

我们在使用博客网站的时候,经常会希望对自己发布的文章进行归档处理,例如每个月发布了哪些文...

smtp怎么设置详解

鲶鱼系统可以使用找回密码功能,但是在开启找回密码功能之前,我们必须要进行一项设置,就是S...

Jsnpp框架介绍

现代程序开发多是使用框架来写应用程序,因为框架可以带来事半功倍的效果。对于PHP程序也是...

鲶鱼系统怎么添加附件以及如何在前端页面展示

鲶鱼cms系统5.2.0版以及鲶鱼Blog系统3.2.0版在编辑文章页面新增了上传附件功...

How to use the Catfish CMS system

Section 1: How to add articles

Management background is composed of five bl...

Section 2: to the article to add c...

In the previous section, we talked about how...

Section 3: Add a menu to your site

In the previous section we talked about how ...

Section 4: Page Setup

To the last section we have learned to use t...

Section 5: Change website name, LO...

By the end of the previous section, we have ...

Copyright © 2015 - 2022 Catfish(鲶鱼) CMS
Catfish(鲶鱼) CMS〖181836340〗 一群已满,请加二群:Catfish(鲶鱼) CMS 二群〖292598750〗

   I want to leave a message