Future Projects

I mentioned in a previous post future projects, I’ve decided it is now time to start talking about them, progress on the framework is going well so it can’t hurt.

G3D-Layer
G3D-Layer is the collective name for the modules/addons that I will develop for the framework, initially this will include the PHP MySQL Form Builder, a statistics package and a few other production tools, think image manipulation/management.

Dlayer
Dlayer is the development name for a project that myself and a couple of colleagues starting thinking about around a year ago. Obviously I don’t want to give too much away at this moment because we are still in the early design stage but I can list a couple of points.

  1. It will be built upon the G3D PHP Framework.
  2. It will feature a high level of element customisation, think every element, every property.
  3. Open development system allowing modules to be created by third parties.
  4. Built from the ground up to support multiple projects.
  5. High level of usability, features aimed at both developers and scripters.

At the moment both G3D-Layer and Dlayer are in the planning stages, over the next couple of months development will begin, when we feel that we can reveal more we will.

PHP XML Form Builder – Usage

Update: The XML form builder is now live on the site, it can been seen here.

I still need to add few minor methods to the builder and validator (removing elements, additional xml structure validation, fieldsets, legends) but for all intents and purposes the XML form Builder is feature complete, below is some example code showing typical usage.

// Instantiate a new form object
$formBuilder = new lib_form_builder_xml('test', $this->domain . $this->controller, $this->action);

// Check form posted
if($formBuilder->is_posted('submit_button') == TRUE) {

    // Instantiate validator
    $validator = new lib_form_process_xml('test');

    // Validate against rules in xml file
    if($validator->validate() == TRUE) {
        // Handle additional validation or insert/process data
    } else {
        // Validation failed
        // Add errors to builder
        $formBuilder->set_errors($validator->get_errors());

        // Call to display error at top of form
        $formBuilder->display_errors_top();

        // Call to display inline error messages
        $formBuilder->display_errors_inline();

        // Set error styling for inputs
        $formBuilder->set_error_class_inputs('error_class');
    }
}

// Build form
$formBuilder->build_form_elements();

// Get html for completed form
$html = $formBuilder->get_form();

Listed below are the current set_* methods, as you can see the builder can be quite powerful allowing almost anything to be modified, I still need to add a few that alter structure.

  1. Set class for containers, by elements
  2. Set class for elements, by element
  3. Set disabled elements
  4. Set ids for containers, by element
  5. Set ids for elements, by element
  6. Set preset values
  7. Set readonly elements
  8. Set style for containers, by element
  9. Set style for elements, by element

I now need to add support for all the additional form elements types (XML builder currently only supports the text, textarea, submit and select elements) before I call it complete. I’m planning to add the other types over the next week or so but you never know, I may add just enough to allow me to move on with the rest of the framework.