Creating Your Own Wizard Steps

Wizard steps data for PHP Setup Wizard is stored in the "includes/steps.php" file. Each step is stored in the array and can contain the following items:

  • name (required)
    The name of the step (ie: Database details)
  • fields (optional)
    Array of fields you would like to display such as text box, check box, information message, etc.
  • callbacks (optional)
    Array of user methods that should be executed before the step or after the user hits the "next" button.

Fields

Each field can be of a different type and include various parameters. Available parameters of the fields include:

  • type (required)
    Specifies the type of the field (ie: text box, check box, text area, drop down, etc). See below for a list of available types.
  • label (required)
    Label that will be displayed next to the field (ie: License number).
  • name (required)
    Name of that field that can be used in the callback functions or validations. Must not contain spaces (ie: license_number).
  • items (optional, applies only to "select" and "checkbox" types)
    Includes a list of selectable items (ie: array(1 => 'Option 1', 2 => 'Option 2')).
  • attributes (optional)
    You may include attributes of the field here which will be added for you by the system (ie: array('class' => 'my-new-class')).
  • default (optional)
    Default value of the field.
  • validation
    Validation methods that should be executed after the form is submitted.

Field types

Available field types include:

  • header
    Header or title text.
  • info
    A simple text message.
  • text
    Text box.
  • textarea
    Text area.
  • select
    Drop down box. Items can be specified in the "items" parameter.
  • checkbox
    Check boxes. Items can be specified in the "items" parameter.
  • language
    Drop down box which is automatically populated with available languages for your user to choose from.
  • php-config
    Allows you to specify PHP version and PHP settings required to run your application.
  • php-modules
    Checks if specified PHP modules are installed and loaded.
  • file-permissions
    Checks if specified files/folders are readable/writable.

Examples

Display a welcome message and language selection drop down box.

<?php
$steps 
= array(
  array(
    
'name' => 'Welcome to the wizard',
    
'fields' => array(
      array(
        
'type' => 'info',
        
'value' => 'Welcome to My Application installation wizard. Select your preferred language to begin.'
      
),
      array(
        
'type' => 'language',
        
'label' => 'Language',
        
'name' => 'language',
      )
    )
  )
);
?>

Display a welcome message, text box, drop down box and check box.

<?php
$steps 
= array(
  array(
    
'name' => 'Welcome to the wizard',
    
'fields' => array(
      array(
        
'type' => 'info',
        
'value' => 'Welcome to My Application installation wizard.'
      
),
      array(
        
'type' => 'text',
        
'label' => 'License number',
        
'name' => 'license_number',
        
'default' => '0000-0000-0000-0000'
      
),
      array(
        
'type' => 'select',
        
'label' => 'License type',
        
'name' => 'license_type',
        
'items' => array(
            
'p' => 'Personal',
            
'c' => 'Commercial'
        
)
      ),
      array(
        
'type' => 'checkbox',
        
'label' => 'Addons',
        
'name' => 'license_addons',
        
'default' => array('banner''affiliate'), // these values will be checked off by default
        
'items' => array(
            
'premium' => 'Premium module',
            
'banner' => 'Banner module',
            
'affiliate' => 'Affiliate module'
        
)
      )
    )
  )
);
?>