Jamers Posted December 2, 2014 Report Share Posted December 2, 2014 由于很久没使用IPB论坛,我们可能会基于论坛做一些扩展功能,这就需要使用到扩展插件的制作,根据IPB官方所提供的内容,不足以建立我们需要的插件,但是至少它能够指引我们方向。本帖内容中仅包含简单应用的制作,不涉及后台及安装脚本,但是模板以及语言包是有相应的功能,在此抛砖引玉。安装以及升级部分等有空的时候研究一下。 这里演示的为 helloworld应用,前台默认模块为test 1. 首先在后台建立一个应用(具体位置:系统->应用&模块->应用&模块管理->添加新的应用) 2. 把相应表单填写完成(注意"应用目录",新添的应用必须在 /admin/applications_addon/other 目录下),保存 3. 在对应的目录下建下列几个文件夹: extensions 扩展文件 这里未使用 modules_admin 后台管理模块,这里未使用 modules_public 前台应用模块 setup 应用安装脚本,这里未使用 skin_cp 后台模板文件 tasks 调度文件,这里未使用 xml 相关说明信息,自己使用可以不处理 4. XML目录中相应文件 helloworld_modules.xml 简单演示应用 helloworld test 仅仅在前台显示Hello World 1.0 0 1 24 0 information.xml Hello_World Hello World 0 Jamers 一个简单的应用示例 0 http://www.zomew.net 5. modules_public目录下建立一个test目录,这是前台一个模块名 6. 新建二个文件 defaultSection.php 默认标签 <?php $DEFAULT_SECTION = 'mysection'; ?> mysection.php 操作文件,看好上面的定义。。 <?php class public_helloworld_test_mysection extends ipsCommand { public function doExecute( ipsRegistry $registry ) { $this->lang->loadLanguageFile( array('hello_world_title'),'helloworld' ); //var_dump($this->lang->loaded_lang_files); //var_dump( $this->lang->words['hello_world_title']); $this->registry->output->setTitle( $this->lang->words['hello_world_title'] ); $this->registry->output->addNavigation( $this->lang->words['hello_world_title'], NULL ); //$this->registry->output->setTitle('Hello World'); //$this->registry->output->addNavigation( 'Hello World', NULL ); //var_dump($this->registry->output->getTemplate('helloworld')); $this->registry->output->addContent( $this->registry->output->getTemplate('helloworld')->helloworld() ); $this->registry->output->sendOutput(); } } ?> 7. 语言在Hello_World应用下添加 hello_world_title 条目,如果有多个语言也可以一同添加 8. 在模板中添加一个helloworld的数据,在群组skin_helloworld下,模板内容如下: <div class='row2 ipsPad'> {$this->lang->words['hello_world_title']} {$this->memberData['members_display_name']}! </div> <br /> 这样,一个简单的应用就建立完成了。如果有任何问题请在本版发帖或者回帖。 下面链接是官方的扩展说明: http://www.invisionpower.com/support/guides/_/advanced-and-developers/application/start-here-creating-an-application-r145 仅供参考 Link to comment Share on other sites More sharing options...
Jamers Posted December 2, 2014 Author Report Share Posted December 2, 2014 奉上相关文件及目录,免得手工建立。模板文件自己处理吧。 helloworld.rar Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now