XML Applications

From FiFormsWiki

Jump to: navigation, search

FiForms allows developers to create user interface definitions in XML, making for easier development and more maintainable applications. Using a combination of XML for defining the user interface, XSLT stylesheets for formatting reports, and SQL embedded in the XML user interface documents, complete database applications can be developed in the FiForms Framework without writing a single line of PHP code.

Contents

Application Structure

All FiForms applications for an installation of FiForms are located at the path specified in the %APP_BASE% Configuration element. This is normally the apps/ folder located in the FiForms installation directory. Inside this folder is a separate folder for each application installed. For example, if %APP_BASE% is "C:/xampp/FiForms/apps/" and you have an application called "books" then there will be a subfolder "C:/xampp/FiForms/apps/books/". From now on, we will refer to this folder, in the example "C:/xampp/FiForms/apps/books/", simply as the application folder.

Application Metadata

Each application folder also contains a special file named appinfo.xml. This file contains meta data about your application, and will be generated automatically when you create your application using the application wizard. The object list in the <objects /> element will be automatically re-generated when the application is validated with validated with validatexml.sh or validatexml.bat.

Following is an example appinfo.xml file for the books application, in FiForms version 1.1:

<?xml version="1.0"?>
<application xmlns="http://xml.fiforms.org/FiFormsApplication/" 
        name="books" version="1.1" appversion="1.0" 
        url="http://demo.fiforms.org/books/" format="meta">
  <title>Example Bookshelf Application</title>
  <summary>Application designed to demonstrate the capabilities of FiForms.</summary>
  <author>Daniel McFeeters</author>
  <copyright year="2007">FiForms Solutions</copyright>
  <license category="lgpl"/>
  <schema default="default">fiforms_sample</schema>
  <objects>
        <directory base="app" path="forms" />
        <directory base="app" path="reports" />
        <directory base="app" path="menus" />
        <directory base="app" path="sql" />
        <directory base="script" path="" />
    </objects>
</application>

FiForms version 1.2 uses a slightly different syntax:

<?xml version="1.0"?>                                     
<application xmlns="http://xml.fiforms.org/FiFormsApplication/" 
      name="books" version="1.2" appversion="1.2"
      url="http://demo.fiforms.org/books/" format="meta">                                     
 <title>Example Bookshelf Application</title>                                                    
 <summary>Application designed to demonstrate the capabilities of FiForms.</summary>             
 <author>Daniel McFeeters</author>                                                               
 <copyright year="2007">FiForms Solutions</copyright>                                            
 <license category="lgpl"/>                                                                      
 <database type="MySQL"/>                                                                        
 <schema default="default">fiforms_sample</schema>                                               
 <objects>                                                                                       
        <directory base="app" path="forms" />
        <directory base="app" path="reports" />
        <directory base="app" path="menus" />
        <directory base="app" path="sql" />
        <directory base="script" path="" />
 </objects>
</application>

Application-Specific Configuration

The application-specific configuration file appconfig.php follows the same syntax and can contain all the same configuration elements as localconfig.php. This file is located in the application directory, and of course, applies only to one application. Any configuration in appconfig.php overrides configuration in localconfig.php.

Custom PHP Scripts

Applications can also include custom PHP scripts, HTML pages, graphics, and other files as part of the application. By convention, these are placed at the path

%SCRIPT_PATH%/apps/%APP_NAME%

In other words, assuming %SCRIPT_PATH% is

C:/xampp/htdocs/scripts 

and your application name (%APP_NAME%) is books, then your PHP script path would be

C:/xampp/htdocs/scripts/app/books
Personal tools