How to creating a Component of Joomla

来源:互联网 发布:淘宝店铺添加背景音乐 编辑:程序博客网 时间:2024/04/30 06:10

For our basic component, we only require five files:

  • site/hello.php - this is the entry point to our component
  • site/controller.php - this file contains our base controller
  • site/views/hello/view.html.php - this file retrieves the necessary data and pushes it into the template
  • site/views/hello/tmpl/default.php - this is the template for our output
  • hello.xml - this is an XML (manifest) file that tells Joomla! how to install our component.

Remember that the filename for the entry point must have the same name of the component. For example, if you call your component "Very Intricate Name Component", at install time (see below in the hello.xml section) Joomla! will create the folder com_veryintricatenamecomponent and the entry point php file must be named veryintricatenamecomponent.php otherwise it will not work. Be aware that use of some special characters, notibly the underscore '_', may have special meaning in Joomla and should be avoided in component names or files.

The site directory here is for the parts of the component which are installed in the front end site.


原创粉丝点击