Chapter 4: Plug-in function functions

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

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系统和鲶鱼blog系统怎么填写公安备案号和ICP备案号

在实际建站过程中,往往需要进行网站备案,那么当我们备案之后,需要按要求在自己网站上放上备...

关于鲶鱼Blog系统2.3.21版以后版本升级的说明

鲶鱼Blog系统可以在后台上传升级包进行升级,有些用户可能会很长时间没有升级,这样可能会...

鲶鱼CMS和鲶鱼Blog自制登录页面代码怎么实现

我们在《鲶鱼CMS和鲶鱼Blog怎么自定义登录页面》一文里面介绍了怎么在制作主题的时候自...

鲶鱼CMS和鲶鱼Blog怎么自定义注册页面

我们在《 鲶鱼CMS和鲶鱼Blog怎么自定义登录页面》这一篇里面介绍了如何自己制作一个登...

鲶鱼CMS和鲶鱼Blog怎么自定义登录页面

我们在使用鲶鱼cms和鲶鱼blog时,有的时候希望根据自己的需求设计登录页面,该怎么办?...

Catfish(鲶鱼) CMS和Catfish(鲶鱼) blog主题...

第五版Catfish(鲶鱼) CMS和Catfish(鲶鱼) blog主题制作手册已经正...

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 - 2020 Catfish(鲶鱼) CMS
Catfish(鲶鱼) CMS〖181836340〗 Catfish(鲶鱼) CMS 二群〖292598750〗

   I want to leave a message
Catfish(鲶鱼) CMS V 4.9.90