Creating Custom Components
Summary: Describes how to create a custom component.
RadPHP XE makes it very easy to create custom components and integrate them into the RadPHP XE IDE for use in developing your PHP applications. While you can write PHP components from scratch, it is faster to use the "New Component" wizard to create the basic skeleton of the component which you can customize. To create custom components
- Choose Component New Component .This opens the "New Component" wizard.
- Click the "Ancestor Type" drop-down arrow and choose one of the installed components on which to base your custom component.
- Type the name for the new component in the "Classname" field.
For example, you could create a component based on the <keyword> Edit</keyword> component and name it LabelEdit .
- Click the drop-down arrow for the "Palette Page" field and select the page on which to install your this component.
- Check "Create Package" to also create a new package for the component.
- Click "OK".
The wizard creates two source files for the component: one for the component with the extension .inc.php , and one for the package with the extension .package.php . When you save the files, you can rename them from the default names assigned to them bye the wizard.
A RPCL component must include rpcl.inc.php and the unit that controls the base class. The wizard automatically does this:
//Includes require_once("rpcl/rpcl.inc.php"); use_unit("designide.inc.php");
Now you can modify the component, save it, and install it on the "Tool Palette" for use in your applications.
Create a subfolder for your custom components in the RadPHP XE rpcl folder. That way you can build your own libraries without affecting the RPCL code base and you can more easily deploy your components to other users.