Joomla2.5 Component 组件开发入门之HelloWorld 详解!

一  初级HelloWorld

组建是放在components目录下面的。

1、我们可以在Joomla根目录下直接新建一个目录com_helloworld

注意:组建目录都是以com_开头的。

2、在com_helloworld目录下新建 helloworld.php  

注意:命名要和目录名一致!

helloworld.php 内容:

hello world



测试:

http://localhost/index.php?option=com_helloworld


这个错误是正常的,因为我们没有安装正规的方法来。

继续看下面

二、helloworld之完善

用正规的方法,来开发一个可安装的组件,ZIP压缩文件!

重新在外面另建一个文件夹com_helloworld

在此文件夹下新建:

site/helloworld.php  (前台)

site/index.html (前台)

admin/helloworld.php (后台)

admin/index.html (后台)

hellowold.xml (安装该组件的一些配置信息)

下面来介绍各文件的内容:

site/helloworld.php

Hello world


admin/helloworld.php:

Hello World Administrator
hellowold.xml

<?xml version="1.0" encoding="utf-8"?>
<install type="component" version="2.5">
<name>helloworld</name>
<creationDate>2011-11-09</creationDate>
<author>gao tong</author>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<version>1.01</version>
<description>Hello World Test Component ...</description>

<files folder="site">
<filename>index.html</filename>
<filename>helloworld.php</filename>
</files>


<administration>
<menu img="components/com_proforms/images/love.png" >COM_HelloWorld</menu>
<files folder="admin">
<filename>index.html</filename>
<filename>helloworld.php</filename>
</files>
</administration>

</install>

上面的配置比较的重要的就是 指定所有的文件,要正确!

<administration>必须要有,组件的安装是前台和后台都要有的

 index.html 

可以留空!或:

<html><body bgcolor="#FFFFFF"></body></html>


最后:打包成ZIP,已经可以安装了。

在后台安装该组件。后台组件里面就可以看到这个组件了。

打开之后:


前台测试:http://localhost/administrator/index.php?option=com_helloworld



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值