Get Started with RPCL Components

From HTML5 Builder
Jump to: navigation, search

The RPCL is a powerful open source PHP framework that implements Delphi’s component-based development using web technologies. The RPCL defines a PHP class hierarchy with a common ancestor: Object. Its most important descendant class, Component, is the common ancestor for other classes called ‘components’, which are the base of the RPCL.

The component approach allows programmers to extend the RPCL with many additional components, either brand new or based on existing components, bringing into PHP an unmatched level of code reuse, and making web development both easier and quicker, without sacrificying performance or flexibility. For more information on components, see this page.

You can write your own RPCL components, and install them on HTML5 Builder so you can use them as any other component, as if they were part of the RPCL itself. For additional information about components and its usage, see Components.

Requirements

Components are written in PHP, which is used to provide server-side features and print client-side code for client-side features (HTML, CSS, JavaScript…).

For a better integration with HTML5 Builder, you might need to write Delphi code.

Creation

To create a new component:

  1. Go to Home > New > Other Projects > Other Files, select Component and click Create. A dialog will pop up.
  2. Enter the required data:
    1. Ancestor class is the class the new component will inherit from. All components should inherit from other components or from the Component class itself.
    2. Classname is the name of the new component.
    3. Palette Page is the name of the section of the Tool Palette where the component should be placed. Only relevant if you check Create package.
    4. Optionally, check Create package to get an RPCL package generated for your component.
    5. Click OK.

You can then use the generated definition file (.inc.php) to develop your component. If this is your first component, follow the Hello World tutorial.

Note: You can define several components on the same file.

Directory Tree

Component files must be placed in the RPCL folder, and as long as you match that requirement, they will work. But in preparation for the later deployment and possible distribution of your components, you should organize them using a tree of directories like the following, with the RPCL folder as root:

  • rpcl
    • Company (The name of your company)
      • Project1 (A name for a group of components)
        • packages
          • icons (Folder to store the icons for your components)
          • Package1.package.inc
          • Package2.package.inc
        • ComponentsDefinitionFile1.inc.php
        • ComponentsDefinitionFile2.inc.php
      • Project2

For example:

  • rpcl
    • MyCompany
      • networking
        • packages
          • icons
          • standard.package.inc
          • advanced.package.inc
        • main.inc.php
Personal tools