SimpleWebFront Developer Documentation | ||
---|---|---|
Prev |
This chapter deals with the PHP-Code of the template-files of Layout Standard. While probably not that many people have Delphi or Kylix installed. the PHP-source-code will hopefully interest more people. Moreover it is necessary to include the PHP-soure in every binary distribution whereas this is not necessary for the Delphi/Kylix code of the program.
You can find all of the PHP-source files in Data/Plugins/SimpleWebFront/Standard.
You should already know that there are four PHP source-files, each one responsible for one specific webpage. (indexpage, Grid-View, Insert and Update-Popup Windows) The file commonFunctions.php contains common functions that are used in several of the other files.
Moreover you should know that the PHP-files are pretty much self-contained. One could say that the interface to the SWF-program consists only of string patterns of the form /*[[PATTERN]]*/. The SWF replaces these patterns in the process of creating the webpages. What follows now is a list of all supported patterns for each of the files.
Table 3-1. Patterns replaced in index.php:
Pattern | Description | Example |
---|---|---|
/*[[HEADING]]*/ | The heading of the index-page. This is the Web-Title that the user enters. | "Bookshop"; |
/*[[IMAGE_NAMES]]*/ | Will be expanded to an associative array that lists the filename of the icon for each view. | array ( "Tables.Customer"=>"icons_02.png","Tables.Publisher"=>"icons_04.png"); |
/*[[INDEX]]*/ | Replaced by function calls to the php-function displayGroup for each group. These function calls are put inside html-tables so that the group position is as specified by the user. | <table border="0"><tr><td> <?php displayGroup("Tables",array( "Customer"=>"Tables_Customer.php?page=0&mode=normal","Publisher"=>"Tables_Publisher.php?page=0&mode=normal") ); ?> </td></tr></table> |
Table 3-2. Patterns replaced in gridTemplate.php:
Pattern | Description | Example |
---|---|---|
/*[[VIEWNAME]]*/ | The name that will appear as heading. | "Book"; |
/*[[FILENAME]]*/ | The name of the current file. | standard_book.php |
/*[[TABLENAME]]*// | The name of the Main-Table. | book |
/*[[DATATYPES]]*/ | maintains a column=>Datatype mapping for every column of the mainTable | array("name"=>"INTEGER",...) |
/*[[TABLEKEY]]*/ | an array that contains the name of all columns that make up the primary key of the maintable | array("product_id") |
/*[[TABLEDISPCOLS]]*/ | an array that contains the name of all columns that should be displayed | array("product_id", "name","desc") |
/*[[JOINTABLENAMES]]*/ | A normal(numeral) array that lists the names of all Lookup-Tables | array('testTable1', 'testTable2') |
/*[[JOINTABLES_KEY]]*/ | For each joinTable present in $joinTablenames this associative array keeps an array with the column-names of the key | array ("product" => array ("productId"), "testTable" => array("Key_part1","Key_part2")) |
/*[[JOINTABLES_DISPCOLS]]*/ | For each joinTable present in $joinTablenames this associative array keeps an array with the names of all columns that should get displayes | array( "testTable1" => array( "testTable1Id","comment"), "testTable2" => array( "col1","col2","col3")) |
/*[[NMTABLENAMES]]*/ | A normal(numeral) array that lists the names of all NM-Tables | array('testTable1', 'testTable2') |
/*[[NMTABLES_KEY]]*/ | For each nmTable present in $joinTablenames this associative array keeps an array with the column-names of the key | array ("product" => array ("productId"), "testTable" => array("Key_part1","Key_part2")) |
/*[[NMTABLES_DISPCOLS]]*/ | For each nmTable present in $joinTablenames this associative array keeps an array with the names of all columns that should get displayes | array( "testTable1" => array( "testTable1Id","comment"), "testTable2" => array( "col1","col2","col3")) |
/*[[NMTABLES_DATATYPES]]*/ | For each nmTable present in $joinTablenames this associative array keeps an (again associative) array that has the form column=>Datatype | array ("customer" => array ("customerId"=> "INTEGER","Name"=> "VARCHAR")) |
/*[[CONNECTIONTABLENAMES]]*/ | A normal(numeral) array that lists the names of all connection-Tables (tables that are introduced to realize an n:m relationship) | array('testTable1', 'testTable2') |
/*[[WHERE_CONSTRAINT]]*/ | The whereConstraint that the user has entered;doesn't begin with WHERE | book.isbn="08850238" |
/*[[ROWSPERPAGE]]*/ | the number of data tuples to be shown on a page | 20 |
/*[[GRID_AS_POPUP]]*/ | a boolean value that tells us if this (grid-)window is shown as a popup or not | true |
/*[[FORMHEIGHT]]*/, /*[[FORMWIDTH]]*/,/*[[FORMX]]*/,/*[[FORMY]]*/ | the dimensions of the update and insert-window | 500 |
/*[[COLUMN_CAPTIONS]]*/ | An array describing the (user-defined) captions of all columns that will shown to the user instead of the db-names. The qualified db column-name is used to index the array | array('product.Name' => 'Name',...) |
/*[[COLUMN_WIDTHS]]*/ | An associative array that lists all columns that have a width specified with their respective width-values in pixels.The qualified db column-name is used to index the array | array("testTable1.column1" => 55) |
/*[[COLUMN_TRUNCATE_CHARS]]*/ | An associative array that stores all columns that should truncate their contents to a specified number of characters;The qualified db column-name is used to index the array | array("testTable1.column1" => 5) |
/*[[KEY_MAPPING]]*/ | This array stores a mapping of qualified column names to the (qualified) column names they reference. Consequently the index consists only of qualified foreign keynames; their value denotes the column they are refering to; | array ( "Book.Publisher_idPublisher"=>"Publisher.idPublisher") |
Table 3-3. Patterns replaced in updateTemplate.php and insertTemplate.php:
Pattern | Description | Example |
---|---|---|
/*[[TABLENAME]]*// | The name of the Main-Table. | book |
/*[[DATATYPES]]*/ | maintains a column=>Datatype mapping for every column of the mainTable | array("name"=>"INTEGER",...) |
/*[[TABLEKEY]]*/ | an array that contains the name of all columns that make up the primary key of the maintable | array("product_id") |
/*[[TABLEDISPCOLS]]*/ | an array that contains the name of all columns that should be displayed | array("product_id", "name","desc") |
/*[[JOINTABLENAMES]]*/ | A normal(numeral) array that lists the names of all Lookup-Tables | array('testTable1', 'testTable2') |
/*[[JOINTABLES_KEY]]*/ | For each joinTable present in $joinTablenames this associative array keeps an array with the column-names of the key | array ("product" => array ("productId"), "testTable" => array("Key_part1","Key_part2")) |
/*[[JOINTABLES_DISPCOLS]]*/ | For each joinTable present in $joinTablenames this associative array keeps an array with the names of all columns that should get displayes | array( "testTable1" => array( "testTable1Id","comment"), "testTable2" => array( "col1","col2","col3")) |
/*[[NMTABLENAMES]]*/ | A normal(numeral) array that lists the names of all NM-Tables | array('testTable1', 'testTable2') |
/*[[NMTABLES_KEY]]*/ | For each nmTable present in $joinTablenames this associative array keeps an array with the column-names of the key | array ("product" => array ("productId"), "testTable" => array("Key_part1","Key_part2")) |
/*[[NMTABLES_DISPCOLS]]*/ | For each nmTable present in $joinTablenames this associative array keeps an array with the names of all columns that should get displayes | array( "testTable1" => array( "testTable1Id","comment"), "testTable2" => array( "col1","col2","col3")) |
/*[[NMTABLES_DATATYPES]]*/ | For each nmTable present in $joinTablenames this associative array keeps an (again associative) array that has the form column=>Datatype | array ("customer" => array ("customerId"=> "INTEGER","Name"=> "VARCHAR")) |
/*[[CONNECTIONTABLENAMES]]*/ | A normal(numeral) array that lists the names of all connection-Tables (tables that are introduced to realize an n:m relationship) | array('testTable1', 'testTable2') |
/*[[COLUMN_CAPTIONS]]*/ | An array describing the (user-defined) captions of all columns that will shown to the user instead of the db-names. The qualified db column-name is used to index the array | array('product.Name' => 'Name',...) |
/*[[COLUMN_WIDTHS]]*/ | An associative array that lists all columns that have a width specified with their respective width-values in pixels.The qualified db column-name is used to index the array | array("testTable1.column1" => 55) |
/*[[KEY_MAPPING]]*/ | This array stores a mapping of qualified column names to the (qualified) column names they reference. Consequently the index consists only of qualified foreign keynames; their value denotes the column they are refering to; | array ( "Book.Publisher_idPublisher"=>"Publisher.idPublisher") |