请登录后探索更多精彩内容!
Xiuno BBS 的插件机制分为两种,一种是 Hook,一种是 Overwrite。所谓 Hook,就是往代码里插入代码,多个插件的代码合并后插入到 hook 指定的位置,最后生成的代码存放于 tmp 目录,被 include
在”Hello, Xiuno Plugin“章节中的实例就是基于 Hook 的。
文件 view/htm/header.inc.htm 中的代码,包含一个 hook header_body_start.htm,我们来将代码插入到此处:
<body> <!--{hook header_body_start.htm}--> <div id="wrapper">
制作插件 A: plugin/ my_plugin_a/ conf.json hook/ header_body_start.htm 假定 header_body_start.htm 的内容为: Hello, Pugin A 有插件 B: plugin/ my_plugin_B/ conf.json hook/ header_body_start.htm 假定 header_body_start.htm 的内容为: Hello, Pugin B
那么最后生成的文件位置在 tmp/view_htm_header_body_start.htm,内容为:
<body> Hello, Pugin A Hello, Pugin B <div id="wrapper">
因为程序在 include 时候做了转换: include _include('./view/htm/header.inc.htm'); // 基本等价于: include ''./tmp/view_htm_header_body_start.htm;
暂无评论
暂无评论