phpClick
Home Credits Demo Documentation Download FAQ

Documentation > Guide to creating new components

Guide to creating new components

Disclaimer: This is just a first high-level draft and needs a lot of refinement to describe the details...

Overview

phpClick works with the concepts of components. Components are self-contained units of HTML and PHP code that the end-user can position on a page. Examples for components already built into phpClick are "htmlText", "image", "button", "inputText". We are already planning to offer many more components such as the obviously missing "radioButton", "checkBox" etc. but also more advanced ones such as "dynamicText", "dataTable", "navigation". However, if you have an idea for a custom component and want it in phpClick, you can do it by yourself by following the process described below.

Each component is represented by a number of files underneath a folder with the components name in the main folder "components". For example, the component "image" consists of the following files:

The central part of a component is the class that implements its behavior. Each component inherits from the class "Component" (/includes/Component.inc.php). Each components needs to implement the interface "ComponentInterface" (/includes/ComponentInterface.inc.php) which requires the following methods:

Click on the method names above to see a description of their function.

Step-by-Step from 10,000 feet :)

To create a new component you should take the following steps:

  1. come up with a concise component name (no spaces or funny characters), e.g. "colorPicker"
  2. create a folder underneath /components/ with the name of your component, e.g. "/components/colorPicker/"
  3. find one of the already existing components that is closest to what you want to do and copy its class file into the newly created folder; rename it to match your components name, e.g. "/components/colorPicker/componentColorPicker.inc.php
  4. copy an appropriate image file with the name "icon.png" into the folder
  5. create a file with the name "name.html" which contains nothing but the user-friendly name of your component, e.g. "Color Picker Tool"
  6. edit at least the four methods/functions described above to implement the behavior of your component (This sounds quite easy but may be non-trivial depending on the complexity of your component. I strongly recommend you look at the existing components to get an idea how things work)
  7. modify "/components/factory.inc.php" and "/components/index.xml" to register your component with phpClick
  8. Test you component and send us your code... :)





http://phpclick.sourceforge.net/
Last modified: October 7, 2004
You are visitor number 1 since Jun. 26, 2017.

web hosting kindly provided by SourceForge.net Logo