PHP 11 Users Guide
PHP 11 Users Guide
This publication supports Clarion. It is possible that it may contain technical or typographical errors. SoftVelocity Incorporated provides this publication as is, without warranty of any kind, either expressed or implied.
Version 1.1
SoftVelocity Incorporated 2335 East Atlantic Blvd. Suite 410 Pompano Beach, Florida 33062 (954) 785-4555 www.softvelocity.com
Trademark Acknowledgements: SoftVelocity is a trademark of SoftVelocity Incorporated. Clarion is a trademark of SoftVelocity Incorporated. Microsoft, Windows, and Visual Basic are registered trademarks of Microsoft Corporation. All other products and company names are trademarks of their respective owners.
Contents:
Ch. 1: Introduction 7
Overview....................................................................................................................... 7 Road Map ..................................................................................................................... 9 Preparation ................................................................................................................. 11 Creating/Modifying the Application ............................................................................. 13 Adding Clarion/PHP ............................................................................................. 14 Procedure Customizations................................................................................... 15 Generating and Incorporating .............................................................................. 16
Ch. 2: Setup
17
Clarion/PHP Template Installation.............................................................................. 17 Apache Web Server Setup (Windows)....................................................................... 18 Installation Notes.................................................................................................. 18 Testing and Starting Apache................................................................................ 22 More on Testing ................................................................................................... 24 Final Note on Apache Setup ................................................................................ 24 Installing PHP (Windows) ........................................................................................... 25 Install Steps.......................................................................................................... 25 Testing the PHP Installation................................................................................. 29 Confirm the PHP Path.......................................................................................... 31 Installing ADOdb (Windows)....................................................................................... 32 Installation of ADOdb ........................................................................................... 32 Testing ADOdb..................................................................................................... 35 Linux Installation Issues ............................................................................................. 36 Apache and PHP: Testing.................................................................................... 37 ADODB ................................................................................................................ 38 Installation of ADOdb ........................................................................................... 38 PHP Include Path................................................................................................. 39 Database Setup ................................................................................................... 40 Running Clarion on Linux..................................................................................... 41 Default Virtual Images Directory................................................................................. 42 PHP, ADODB and Database Access ......................................................................... 42 PHP/ADODB Applications ................................................................................... 43 Database Access ................................................................................................. 44 Clarion Programmers and PHP/ADODB.............................................................. 45 FAQs and Troubleshooting ............................................................................................... 46 Configuring PHP ......................................................................................................... 46 How can I make sure that PHP will find the ADOdb support source files, when my generated code has a statement such as include(adodb.inc.php)?.................. 46 I am using MSSQL and I have an image on my form but it doesnt display? ...... 46 How does PHP know what type of databases that it must support? ................... 47 Is there special configuration rules for PHP used with Apache? ......................... 47 Is there a simple way to keep all program images in the same place? ............... 47
CLARION/PHP Users Guide ADODb ....................................................................................................................... 48 How do I install ADODb to my target server? ...................................................... 48 What is the best way to test an ADODb connection? .......................................... 48 Configuring Apache .................................................................................................... 49 How do I create a virtual directory using Apache? ............................................ 49 Deployment FAQ ........................................................................................................ 50 What do I need to do in order to deploy my application generated by the Clarion/PHP templates?....................................................................................... 50 What do I need to do in order to see the icons and images generated by the Clarion/PHP templates?....................................................................................... 50 HTML (Hypertext Markup Language) ......................................................................... 51 PHP Language ........................................................................................................... 53
55
How PHP Fits In with Clarion ..................................................................................... 55 Whats Special About Our PHP Code.................................................................. 56 Interaction with Dictionary.................................................................................... 57 Navigational Links in Clarion/PHP.............................................................................. 58 Window and Control Formatting ................................................................................. 59 Security Levels ........................................................................................................... 59 Language.................................................................................................................... 60 Database Access - DBMS Requirements .................................................................. 60
61 63
Application How-Tos................................................................................................... 63 Application of Global Template ............................................................................ 63 Application of Browse Template .......................................................................... 64 Application of Form Template .............................................................................. 65 Browse/Form/Browse or Query/Browse/Form ..................................................... 66 Link a Browse and Form ...................................................................................... 67 Form Without a Browse........................................................................................ 70 A Query Page....................................................................................................... 70 Browse to Browse ................................................................................................ 71 Select Browses .................................................................................................... 73 Table Loaded Selects on Forms .......................................................................... 74 How to Prime a Field on an Update Form............................................................ 75 Help and Popup Windows.................................................................................... 75 Testing How-Tos........................................................................................................ 77 Testing on Your Local Machine ........................................................................... 77 Integration/Deployment How-Tos .............................................................................. 79 HTML Template ................................................................................................... 79 Style Sheets ......................................................................................................... 80 Collected Data from Forms on Your Site ............................................................. 81 Passing Data to Other Parts of Your Web ........................................................... 81
83
87
PHP Global Template Options ................................................................................... 87 Global Options/Global Tab................................................................................... 87 Global Options/Cascading Style Sheets .............................................................. 89 HTML Design Time Templates ............................................................................ 89 List Defaults ......................................................................................................... 90 Form Defaults Button ........................................................................................... 93 Global Options/Generation Tab ........................................................................... 97 Global Options/Database Tab.............................................................................. 99 Connection Parameters: .................................................................................... 102 Global Options/Security Tab .............................................................................. 103 Global Options/Administration Tab .................................................................... 107 Images ............................................................................................................... 109 User Data ........................................................................................................... 110 Includes.............................................................................................................. 111 The PHP Frame Extension Template....................................................................... 112 The PHP Browse Extension Template ..................................................................... 113 Browse Options/Globals Tab ............................................................................. 113 Browse Options/Page Tab ................................................................................. 117 Browse Options/HTML Table Tab...................................................................... 119 Browse Options/Default SQL Tab...................................................................... 122 Browse Options/Data Columns Tab................................................................... 123 Data Columns/General Tab ............................................................................... 126 Data Columns Properties/Actions Tab............................................................... 127 Data Columns/Properties/Column Sorting Tab.................................................. 130 Data Columns/Properties/Appearance Tab ....................................................... 131 Browse Options/Custom Columns Tab.............................................................. 132 Custom Columns Properties/Appearance Tab .................................................. 134 The PHP Form Extension Template......................................................................... 138 Form Options/Global Overrides ......................................................................... 138 Form Options/ActionsTab .................................................................................. 142 Page to Return To.............................................................................................. 143 Form Options/Help ............................................................................................. 145 Form Options/Data Access Tab......................................................................... 146 Form Options/Controls Tab................................................................................ 147 Form Options/Custom Controls Tab .................................................................. 153
157
Global Template Declarations .................................................................................. 158 Accessing the Embed Points.................................................................................... 159 Browse Embed Points .............................................................................................. 159 Examples .................................................................................................................. 163 Form Embed ...................................................................................................... 163 Additional Form Embed...................................................................................... 166 Browse Embed................................................................................................... 167
169
Understanding the Process ...................................................................................... 169 What to Use it For..................................................................................................... 172 Final Notes................................................................................................................ 173
175
179
Style Sheet Tab ........................................................................................................ 180 Body Tag Tab ........................................................................................................... 183 Background Class Tab ............................................................................................. 186 Borders Button - Data Tab ................................................................................. 188 Margins Button - Data Tab................................................................................. 189 Padding Button - Data Tab ................................................................................ 189 Header Button - Data Tab .................................................................................. 190 Column Label Button - Data Tab ....................................................................... 191 Data Rows Button - Data Tab ............................................................................ 192 Footer Button: Data Tab..................................................................................... 194 Input Label: Data Tab......................................................................................... 195 Input: Data Tab .................................................................................................. 195 Style Sheets.............................................................................................................. 197
Index:
199
Ch. 1:
Introduction
This chapter summarizes Clarion/PHP programming and deployment. Clarion/PHP generates PHP pages (PHP originally stood for Personal Home Pages but has outgrown that acronym considerably), each of which serves to publish a standard business procedure such as query a table or view, browse (display and allow navigation through the results of a query or a table), or updates (add new record, change record, or delete record). The target platform is Apache, specifically public or high volume sites using Apache, whether *nix or Windows based. Clarion/PHP allows for a high degree of customization of the interface, allowing for excellent integration into existing sites. All business and application logic is strictly divided from the interface; in fact a web developer may safely edit the HTML and Cascading Style Sheets which provide the setting for the database components without fear of breaking the php code. Clarion/PHP uses an open source data access library called ADODB which allows data access from PHP code. Clarion/PHP is one component (the other is Clarion/ASP) of the Clarion web templates. Both Clarion/ASP and Clarion/PHP can be applied within a single application, and be managed with the same extension options (other than certain global settings such as database access).
Overview
The following is meant to convey a conceptual summary of the Clarion/PHP code generation process, for the developer familiar with creating desktop applications: The modular application pages that Clarion/PHP generates fit together with links. You therefore apply Clarion/PHP to the individual procedures for which you want to provide web access. Clarion/PHP reads your data dictionary and builds a default procedure (as an extension to your existing procedure). Then you customize the Clarion/PHP procedure settings using the template interface, rather than the formatters or Clarion embeds. This makes it important that you use the Validity Checks tabs in the dictionary for all related fields. This helps the template create a pseudo application flow for stateless http (stateless means that each page is isolated, and cant see variables contained on the previous or next pages). Youll also build a connection string (using a wizard) that tells ADODB how and where to access the database server. In essence, these items function as the database/driver/tables settings for the application. Youll create a style sheet that controls the appearance for everything, using the template interface and an HTML template which will act as a setting into which Clarion/PHP will place the controls it generates. This is roughly equivalent to
CLARION/PHP Users Guide setting global window and control appearance properties for your application (all of which can be overridden at the procedure level). You can add many further behavior or appearance customizations through the template interface. In addition to the various database behaviors in your application, these may include links to other non-Clarion/PHP generated pages at the site, incorporation of various images stored at the site, etc. These function as the directives (and to some extent in the case of custom links, embedded code) that tell the Clarion Application Generator what customizations for functionality and appearance to place in the generated code. Youll generate the pages. In this case, generating source code is all that is necessary; no compiler needs to be called because PHP is a scripting language. You (and your web administrator) are then free to further customize the generated pages (for appearance, application behavior, etc.). Apache, PHP and ADODB are available for all current Windows platforms, so the developer may test and debug the application on the machine that they develop on. Then you integrate the pages into your existing web, and copy them to an Apache server, which is equivalent to deploying the application.
Note that you apply the Clarion/PHP templates first as a global extension template, and then on a procedure-by-procedure basis. When you apply the browse extension template to a browse, it will automatically create a link to the appropriate update form, but you must manually apply the form extension to its update procedure. In other words, if your application has fifty procedures, for which you wish to enable PHP for five browse and five form procedures, youll first apply the global template, then apply the PHP browse template five times, i.e., once for each of the five browses, and five times for the forms.
Road Map
Detailing the actual steps summarized in the conceptual overview above, this section provides a simple overview of the development and execution of an application, from scratch. The developer starts with a Clarion database dictionary describing the structures in an SQL DBMS (hereafter, DBMS will refer to any client server relational Database Management System such as Oracle, IBM DB2, Postgres, mysql, etc). The developer pre-formats the dictionary to include all relations, business rules, additional indices where a sort order request is expected, plain English descriptions for tables and fields, and control pre-formatting. The developer optionally adjusts the field order within each table as well as sets the do not populate options as appropriate, in preparation for running the application wizard. Clarion/PHP reads the list boxes (for browses) and windows (for forms) generated by the application wizard in order to determine which fields it should populate in its tables (for browses) and forms, in the order that the fields appear in those structures. The developer runs the application wizard (or creates an empty .app file and manually populates browse and form procedures). The developer applies the Clarion/PHP global extension template, specifying, at that time, the database, type of access, the database server, the HTML design time template, and the style sheet options, i.e., the global connectivity, look and feel options. The developer decides which procedures require PHP page equivalents. The developer applies the browse and form procedures respectively to the browses and forms in the application. The developer customizes the various fields within each procedure where necessary, using the design time interface. The developer links additional procedures as needed using the design time interface. (As an example, a navigational list view (browse) of a products table might link not only to the update form for the product, but also to a browse of all products by the supplier of the original product, and/or a browse of all products in the same category as the selected product). The developer tests the various procedures locally using the Clarion/PHP generated menu page and optionally, a local copy of Apache.
10
CLARION/PHP Users Guide The developer fine tunes each procedure as necessary, whether for application logic, or look and feel. The developer generates the pages and tests them locally. The developer and web administrator together may optionally fine tune the generated pages. The developer and web administrator together provide links as needed, to/from the rest of the site to the PHP pages, and upload the PHP pages for deployment.
11
Preparation
As with normal Clarion programming, start with a data dictionary. In general, Clarion/PHP, if applied to an existing application procedure, ignores the control formatting customizations in the procedure, and instead reads the customizations in the dictionary. It only refers to the window in the procedure to determine what fields to populate, and in what order. The starting point should be a data dictionary referencing an SQL database. Note that Clarion/PHP was not designed for ISAM databases. All the access syntax generated in your php procedure pages will be ADO/SQL specific. Every table you require should exist in the dictionary. If you wish to set a particular field order, you may do so in the dictionary. Every relationship should be properly defined. Every table should have a key defined with a primary attribute (in the Clarion dictionary; the DBMS will no doubt have a primary key). Every view, should you intend to use it in the PHP pages, should have at least one key defined, i.e., a field(s) selected that can later be specified as an SQL Order by clause. We encourage you to work with the database administrator to create VIEWs. A helpful hint: remember that there will be no such thing as reports. (Every HTML page full of data is already a formatted document). If an existing application contains some useful reports that access multiple tables, you may wish to examine the underlying Clarion VIEW structure and create or ask the DBA to create a similar SQL view. This makes it easy to create a browse displaying the same data. Such a report can easily be made read only, and you can set the number of rows to display to as many rows as you wish. Unless you dont require security at all, you should add, if no such functionality exists within the current database, a users table which will hold user names, passwords, security access level and email addresses. See Global Options/Security Tab for details. If youre deploying an SQL/PHP version of an existing Clarion desktop application which utilizes an ISAM database, we also encourage you to work with your DBA to create triggers to replace some of the business logic in the desktop application. Remember that since Clarion/PHP outputs only PHP code, Clarion code in template embed points is completely ignored. Within the dictionary, fill in the description fields for tables, keys and columns. These will function as default tool tips in your Clarion/PHP application. Note that Clarion/PHP picks up all its formatting options from the dictionary; not from any attributes added to a control in the window formatter. The only thing that
12
CLARION/PHP Users Guide Clarion/PHP will pick up from the window formatter will be the fields list: those fields present as entry controls in the update forms, and the columns within a list box within a browse procedure. (Note: in this case, entry refers to any control that accepts user entry, not just entry boxes.) Check the Do Not Populate option for all tables, keys and fields you will not wish to populate under any circumstances. Check that the template has populated the proper SQL date/time field in cases and not fields for which the dictionary import wizard has automatically created a GROUP over that date/time field. Clarion/PHP uses the SQL date/time field, not the Group or its components. Fill in the description and prompt text for all fields you expect to populate. Set the Justification option on fields as necessary. Fill in the Validity Checks tab in the Fields Properties dialogs wherever possible, using the Must be in File option on primary/foreign key relations. When you place a file drop list control template, or combo drop control template in a Clarion window, Clarion/PHP can then populate a list filled from the related table. Additionally, for non-linking fields, fill in ranges, true/false, Must be in List wherever possible, so that Clarion/PHP can generate JavaScript client side validations. In general, the more client side validity checking your PHP application can do, the less need for communication of error messages between the DBMS and the end user. Set up window control types (such as radio buttons, as opposed to entry boxes) and control properties for fields wherever possible. Bear in mind that some attributes will be ignored (e.g., font, transparency, mouse cursor) because they are not supported in HTML.
All the above actions emphasize storing application design in the dictionary as much as possible, which is an excellent every day strategy for any Clarion developer who creates multiple applications which access the same database whether using Clarion/PHP or not. Many Clarion developers already do so as a matter of course.
13
14
Adding Clarion/PHP
Youll apply Clarion/PHP as a global extension template, by choosing the PHP Global Extension template. This manual contains detailed instructions on the template interface options for the global extension. You must add the global extension before you add any procedure extensions. The global extension merely sets the defaults. After setting the global extension, you then add the PHP browse and form procedure templates to the procedures for which you wish to generate PHP pages. You cannot apply the procedure extension templates until youve added the global extension, and you will not generate any PHP procedure pages unless youve then added the PHP procedure templates to a procedure(s). When you add the global extension, you must define a connection string. Your PHP application does not use Clarion drivers. It uses the ADODB libraries, which provide for an ADO-like syntax on many OS platforms, which allows us to standardize the access code for both PHP and ASP. A connection string is merely a list of parameters that ADODB requires to access the database. The Connection will provide a dialog for you to choose your database target and build your connection string. You may define the style sheet and the HTML template when you apply the global extension, or do it afterwards. The style sheet is much like a style list you may be familiar with from word processors. For Clarion/PHP, for each part of a browse or form, youll use a separate style, which holds the coloring, font, sizing and font attributes choices. Using style sheets allows the web site to completely change the look of the site by editing only a single file. The HTML design time template provides a setting for the browses and forms; in effect, you may place HTML elements such as a logo or text above and/or below the browses and forms, set page background colors, etc. If your site already has a template for web pages, you may easily take this, add a single text symbol, and thereafter all your generated pages will appear inside your template. At the global level, youll also set security options. Clarion/PHP makes implementing a flexible security policy (for example, you may allow some users to edit certain data, others to view it and still others not to view it at all) very straightforward.
15
Procedure Customizations
Youll apply the procedure extension template only to those procedures for which you wish to generate PHP pages. In many cases, youll elect to edit the list of fields contained within the browse. There are two reasons for this; your data displays in a table that is not scrollable, and, the more data in the table, the more network communications and memory usage are required by browser, server, and DBMS. In general, we recommend limiting the number of columns to four or five. Youll also have an option to either allow for a button at the left or right of a browse row to link to an update form, or define link fields, so that when the end user clicks a data item in a row it opens the update. You can also include custom columns, which may contain an image linking to another procedure or even to a page elsewhere in your site. Custom links provide you with total control of the link code, from <a> to </a>. They require a little HTML knowledge but can be very powerful. You may wish to specify security levels for the forms. This allows you to define access as edit/view/none dependent on the user. If you defined the Must be in table options in the data dictionary, links to parent tables can provide a select button that provides for a popup window of allowable values from the other table. If you wish, you may instead populate a file drop control template in the form window, which instead populates a file loaded dropdown list box for the end user to choose from. There are many additional options documented within the command reference section of this manual.
16
17
Ch. 2:
Setup
basic setup instructions for Apache, PHP and ADODB (because its anticipated that those products will be new to many Clarion developers). Based on our research, we think that the Apache Web Server is the most popular platform for PHP applications. basic testing instructions for these Apache, PHP and ADODB (to help insure that the developer installed them properly) notes regarding setting up Apache, PHP, ADODB, and MySQL on Gnu/Linux (because its anticipated that this will also be an important deployment platform)
In addition to providing simple setup directions for the Clarion/PHP templates, this section will also provide:
This introductory section will also begin with an overview of PHP technology to Clarion and other database developers who may only have passing familiarity with it, to help you understand what youre installing. PHP has so far been the province of web designers who have learned something of development tools because they had to. Clarion/PHP comes from the opposite direction... its for developers who want to create PHP. Developers bring with them very unique advantages that web designers could not be expected to bring, in areas of programming efficiency and data management. At its simplest, PHP is a form of server side scripting. PHP can be executed from either an Apache module or as a standalone CGI (Common Gateway Interface) application. The former (Apache) requires fewer resources. It receives a request from the web server for a page whose file extension is .PHP. The PHP library examines the page, runs its embedded scripts, and writes an HTML page, which reflects the resolution of whatever script(s) were run. It passes the HTML to the web server, which passes it to the web browser. The web browser receives only the HTML, and never sees the scripts that produced it. When running as a module, the script has access to all the resources that the Apache user account on the web server has.
18
Installation Notes
You may already have a web server (IIS, Personal Web Server, Clarion Application Server) installed on your development machine. This chapter documents the installation of Apache 2.0.39 (Windows 32, no Secure Sockets Layer) on Windows 2000. The installation/setup file, as downloaded from an Apache mirror, was called apache_2.0.39win32-x86-no_ssl.exe. The installer uses the Windows installer; double click the installer to begin.
CLARION/PHP Users Guide The installation wizard begins with a simple introductory screen.
19
The License screen, if you've never installed open source software, may be surprisingly brief:
20
CLARION/PHP Users Guide Next is a small screen of information and links for additional information. Following that, you may choose a few important properties for your server: Your domain... this does not necessarily mean a Windows domain. Remember that Apache runs the majority of web servers on the Internet, and the domain in that context is usually a dot.com, dot.org or dot.net domain! But if you're running on a Windows domain for development purposes, feel free to leave the NT/2000 domain information in. It won't "hurt," and you can change it later. Your server name, followed by the domain information. Your administrator email address. It need not be in the same domain, though it's usually traditional. Probably the most important setting to specify on this screen is the server port. Note that if you are not already running another web server, you may set Apache to install itself on port 8080 (the normal web server port is 80), and if so, it's assumed that you wish the server to be started manually (as opposed to every time you boot the system). You can change both settings later; however these are reasonable defaults for a development machine.
The next installation wizard panel allows you to specify typical or custom installation. Typical installation is probably OK for most developers. The only component not installed with the typical option are the build headers and libraries; unless you think you wish to modify and compile the Apache source, choose Typical.
21
The next panel simply asks you to specify the installation destination directory (press the button should you wish to specify another, and then an announcement panel states that everything is ready, and that you can press the Install button to begin copying the files.
Following the copying of the files, you should see a final panel stating that installation was successful.
22
This is a good introduction to Apache. It works with little flash, and without fancy configuration tools. Some of the Linux distributions have already begun adding graphical configuration tools for Apache, but you'll not find anything on the level of Internet Services Manager. In general, to edit your Apache configuration, you'll edit a text configuration file (called httpd.conf). The basic options, which are probably no further than you'll need to touch on a development machine, are straightforward. The more complicated options, which can indeed be vital in the "real" world of the World Wide Web have had books written about them. In Windows, a typical install places it at C:\Program Files\Apache Group\Apache2\conf\httpd.conf
CLARION/PHP Users Guide Here are some sections of the configuration file that you might want to change after installation.
# # # # # # # Listen: Allows you to bind Apache to specific IP addresses and/or ports, in addition to the default. See also the <VirtualHost> directive. Change this to Listen on specific IP addresses as shown below to prevent Apache from glomming onto all bound IP addresses (0.0.0.0) Listen 12.34.56.78:80
23
Listen 8080 # # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If this is not set to valid DNS name for your host, server-generated # redirections will not work. See also the UseCanonicalName directive. # # If your host doesn't have a registered DNS name, enter its IP address here. # You will have to access it by its address anyway, and this will make # redirections work in a sensible way. ServerName your-machine-name:8080 # Timeout: The number of seconds before receives and sends time out. Timeout 300 #
After installation, to start Apache (assuming you've set it up for manual start as had been recommended above): Start > Programs > Apache HTTP Server 2.0.52 > Control Apache Server > Start Apache Server in Console. Again, your version number may vary. This should lead to a completely blank console box. Don't be alarmed... that's how it's supposed to look. Simply minimize it. If you chose to install Apache as a service, it should already be running. To control it, you'll find an applet on the taskbar. This will also be installed should you choose not to installed as a service, though it may have less "relevance"
24
In the illustration above, the Apache applet icon is the one at the right. To turn Apache off, or to turn it back on again, use the popup menu from the toolbox applet, choose the "Open Services" command, then locate Apache in the Windows services applet, and turn it on or off by double clicking and choosing an option.
More on Testing
The proper way to test Apache is to open your browser and type in http://localhost:8080 (delete the :8080 if you installed to port 80). Immediately following an installation, without having configured a default page, you should see the following:
Likewise, you can open task manager (or wintop, one of the kernel toys for Windows 98) to verify that the Apache.exe process is running (or possibly two such tasks.
25
Install Steps
This documents the installation of the zipped version of PHP. The zip install will contain two versions of PHP; a CGI (Common Gateway Interface, in which commands are executed from the web server) and a SAPI (Server Application Programming Interface, in which the web server calls PHP functions directly. The PHP Group recommends the latter, however the SAPI version will not run with Windows 2000 at the time this manual was written. Therefore, this section documents the use of the PHP/CGI interface. The latest version of PHP at the time of this release is PHP 5, but we will use the more established PHP 4 version as our base install example. Will we mention differences in install configurations throughout this document where appropriate. Download the zip file, which for this example installation is named php-4.3.9-Win32.zip (the latest PHP 4 version at the time of this writing), and open it with your favorite zip management tool. Locate the file Install.txt and be sure to review it (in case there are any differences in subsequent versions vs. the following steps). The install.txt file also contains instructions for different platforms and alternative configurations not covered in this document. After reviewing the instructions, follow these steps carefully to install. Please be careful not to skip any steps. 1. 2. Create a directory for your PHP installation, such as C:\PHP (the standard suggestion) or C:\Program Files\PHP. Unzip the entire compressed file to that directory. If your extraction utility requires you to specify a parameter or choose an option to create subdirectories under the target directory, be sure to do so (Note: unzipping should create several sub folders).
26 3.
CLARION/PHP Users Guide A file called php.ini-dist will have been copied to the target directory. Copy it to the Windows directory (typically C:\Windows for Windows 9x and XP, or C:\Winnt for Windows NT/2000). In the Windows directory, locate php.ini and open it in Notepad or a text editor. Locate the string extension_dir = and change the value to the directory to which you unzipped all the files to, being careful to place double quotes around the directory should it contain any blank spaces. Example:
; Directory in which the loadable extensions (modules) reside. extension_dir = "c:\PHP"
4. 5.
6.
Locate the string cgi.force_redirect = 1 which should be on a line that is commented out (it begins with a semi colon). Remove the semi colon and the space after it, leaving only the string. Example:
cgi.force_redirect = 1
7. 8. 9.
Save and Close the php.ini file. Stop Apache if its currently on. Locate the Apache httpd.conf file, which should be located in a directory called conf, which is located in a directory called Apache 2 (or Apache in earlier versions), which should be located under the directory in which you installed Apache. Open the httpd.conf file in notepad (or your favorite text editor). It may be necessary to create a file association, using the Open With... dialog. Also, because of the case sensitive nature of this file, it is strongly recommended that you back up your httpd.conf file before editing. If you make a mistake, you will most likely not be able to restart Apache. Search for the string Addtype. You should find it in a section with some comments above; the following is the default section found in our installation:
10.
# # AddType allows you to add to or override the MIME configuration # file mime.types for specific file types. # AddType application/x-tar .tgz
27
Insert the following lines below those lines, substituting the name of your PHP install directory for c:/PHP, if you installed to a different target. Note that the file locations use a slash character, and not a backslash character, and that the lines starting with # are just comments:
# # inserted by YourNameHere for PHP Support ScriptAlias /php/ "c:/php/" AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php.exe"
If you are installing PHP to use the CGI binary with Apache 2.0, add the following lines to your httpd.conf file:
ScriptAlias /php/ "c:/php/" AddType application/x-httpd-php .php # For PHP 4 Action application/x-httpd-php "/php/php.exe" # For PHP 5 Action application/x-httpd-php "/php/php-cgi.exe"
If you are installing PHP to use the Apache module DLL with Apache 2.0, add the following lines to your httpd.conf file:
# For PHP 4 do something like this: LoadModule php4_module "c:/php/sapi/php4apache2.dll" AddType application/x-httpd-php .php # For PHP 5 do something like this: LoadModule php5_module "c:/php/php5apache2.dll" AddType application/x-httpd-php .php # configure the path to php.ini PHPIniDir "C:/php"
28
CLARION/PHP Users Guide If you are installing PHP to use the Apache module DLL with Apache 1.3.x, add the following lines to your httpd.conf file:
# For PHP 4 do something like this: # Add to the end of the LoadModule section LoadModule php4_module "c:/php/sapi/php4apache.dll" # Add to the end of the AddModule section AddModule mod_php4.c # For PHP 5 do something like this: # Add to the end of the LoadModule section LoadModule php5_module "c:/php/php5apache.dll" # Add to the end of the AddModule section AddModule mod_php5.c #For both add the following: # Add this line inside the <IfModule mod_mime.c> conditional brace AddType application/x-httpd-php .php # For syntax highlighted .phps files, also add AddType application/x-httpd-php-source .phps
11.
29
2.
3. 4.
5.
Save the file and start Apache. Now verify the httpd.conf file is OK, by opening a command console and typing the following at the c:\> prompt. Be sure to include the double quotes:
A Syntax OK message should appear; if not, you may have typed the section above wrong. 6. Open your browser, and type the following URL in the address box: http://localhost:8080/test.php. (Note: if you did not choose port 8080, omit the :8080).
30
CLARION/PHP Users Guide The result should be a page looking like the one below. Youve now enabled PHP support.
31
32
Installation of ADOdb
This section documents the installation of version 4.53 for Windows, as contained in adodb-4.53-for-php. (This was the latest version at the time this document was released). Using your favorite compression utility tool, unzip all files to a directory accessible to your web server, preserving the directory structure of the zip file. If youre simply following these How tos and have freshly installed Apache, you probably havent set up any virtual directories yet. The simplest way to get started is to create an ADOdb directory under your Apache2\htdocs directory (your default web root), and then extract the files to that location. If you have the ADOdb directory in another location, please review the following configuration settings, and change the PHP.INI file where needed: 1. In the PHP.INI file, search for "include_path =", and change as follows: If you are using Apache2.0.x: If ADOdb is installed under \Apache2\htdocs\:
; Windows: "\path1;\path2" include_path = ".;C:\Program Files\Apache Group\Apache2\htdocs\ADOdb;C:\Program Files\Apache Group\Apache2\htdocs\ADOdb\drivers"
33
Note: Make sure that 'C:\PHP\SessionData' is created, as it is not part of the install.
34
CLARION/PHP Users Guide 3. Finally, search for 'Windows Extensions', and remove the ';' before the DLL that you are using to connect to the database, as follows:
;Windows Extensions ;Note that MySQL and ODBC support is now built in, so no dll is needed ;for it. ;for PHP 5: ;extension=php_ming.dll extension=php_mssql.dll ;extension=php_oci8.dll ;for PHP 5 only: extension=php_mysql.dll
4. Save and close the PHP.INI file. In the above example, we are using the MSSQL and MySQL drivers. You may wish to review the information found in the FAQs and Troubleshooting section if you have trouble with the setup or testing in this section. Youll also find a file called readme.htm. Review that document in case there are changes to the install procedure in the next product updates.
35
Testing ADOdb
The tests directory, which will be located below the target ADOdb installation directory, contains a page called test.php, which will help you test that ADOdb is properly installed. When first loaded, the page should look like the following:
Because connections strings differ depending on what database you may have, the test page will not successfully connect to any database right away. The quickest, easiest test is to set up an ODBC data source for one of the sample databases that are hard coded into the test. When you check one of the boxes and press the Submit Query button, an error message will tell you what the test page expects on the other end. As an example, check the Access box, press the button, and the error message will advise: ERROR: Access test requires a Windows ODBC DSN=nwind, Access driver. To test further, load the ODBC Data Sources applet in Control Panel/Administrative Tools, and create a DSN named nwind, and point it to the northwind.mdb sample database in the Microsoft Office\Office\samples directory (if you have MS Office installed). If ADOdb is working correctly, the connection creates a table in the northwind database called ADOXYZ, inserts test data, retrieves and displays it, as illustrated below:
36
With the installation of ADOdb, youve now installed all the supporting components necessary for Clarion/PHP.
37
In general, with Linux, your starting point will be to test Apache and PHP, add ADODB, and optionally add a database such as mysql. We will take the approach of starting and configuring a Linux machine in your local intranet, or more specifically, one that you have access to so as to allow the installation of any missing software.
Just as you did for PHP with Windows, you must create a test page for PHP. Use the text editor of your choice and create a file whose contents are as follows:
<?php phpinfo();?>
Usually, the default Apache web root can be found as /var/www/html, though its simple to change that. Save your text file to a directory within the web tree, to a file name such as test.php. Remember that Apache/Linux/unix is case sensitive! If you save the file to test.php, and type http://localhost/mydirectory/Test.php, you will receive a page not found error. Load the page in your browser; it should look something like:
If the test page did not display, check to see that its installed. The command to check varies by distribution, but in RedHat, you may display the installation information by logging in as root and typing:
rpm -q php
38
CLARION/PHP Users Guide This should return a string such as php-4.1.2-7.3.4, which is the package name and version. Should you not have PHP installed, you may load your installation disks or download a package from the web. Again, in the case of RedHat 7.3, the command to install PHP, assuming installation disk #2 is loaded in the CDROM, and that the root is logged in:
rpm -ivh /mnt/cdrom/RedHat/RPMS/php-4.1.2-7.i386.rpm
In this case, most knowledgeable users would replace all characters to the right of php-4 with an asterisk. Note also that the package manager will notify should any dependencies require installation first, and finally, that in any other version the version numbers following php would be different. As a reminder, on any machine in which youve specified during installation that the machine is to be a web server, both Apache and PHP should have been installed for you. Finally, remember in case any of the daemons fail to work, check the messages log (tail /var/log/messages) as root.
ADODB
The ADOdb database library for PHP is an open source project whose home page is http://adodb.sourceforge.net. The purpose of ADOdb is to provide a database abstraction layer allowing PHP to use a standardized syntax for access to different databases. This allows Clarion/PHP to connect using the same SQL commands to different DBMSs. The databases supported by ADPdb are MySQL, PostgreSQL, Interbase, Informix, Oracle, MS SQL 7, Foxpro, Access, ADO, Sybase, DB2 and generic ODBC (when the server is Windows).
The ADODB libraries will not have been installed on a default installation of any distribution that we know of. Therefore you must obtain and install them. The most current download is found at the page above. Note that sometimes the text description will state that a previous version may be more stable than the most current version, and guide you to that version. You will download a .tgz file and run configure and an install script; just look for the Download link.
Installation of ADOdb
Create a directory and download the file to it. Once there, depending on the actual file name, run gzip and uncompress it, which should be something like:
gzip -d adodb221.tgz
Its not necessary to make and compile the libraries. The simplest way to extract and install, in fact, is to load the resulting tar file in a file manager which treats a tar archive as a folder, and copy the contents to a directory you create for it in your web root. In our case, we named the directory /var/www/html/adodb.
39
You must uncomment this (or add a path, if already uncommented) to include the directory to which youve extracted the ADODB libraries. For example:
include_path = /var/www/html/adodb
If PHP 5 is installed, and you plan to use MSSQL, make sure to edit the PHP.INI in the Windows directory to "activate" the needed DLL extension. In addition, there are default that needs to be changed in the MSSQL section of php.ini:
; Valid range 0 - 2147483647. mssql.textlimit = 2147483647 ; Valid range 0 - 2147483647. mssql.textsize = 2147483647 Default = 4096. Default = 4096.
Values given here are the ones that replaced the default. This will allow forms with images to be displayed correctly.
40
Database Setup
At this point you could test ADODB; however, generating test data is not as easy as under windows. Should you wish, load http://localhost/adodb/tests/test.php (assuming youve installed ADODB to the same location as noted above), and follow the directions in that page to create a database table and display it. (Frankly, given a well configured system, its probably easier to test ADODB with a Clarion/PHP app!). In many cases, youll first wish to install mysql, should you be creating an in house test bed for your application. Its very likely that this database was not installed with your distribution. To install mysql, using RedHat 7.3 as an example, insert disk 3 in the CD ROM drive, and as root:
rpm -ivh /mnt/cdrom/RedHat/RPMS/mysql*
Should any additional dependencies be necessary, youll be notified and should install the appropriate packages. Theres still one more package to install, which is necessary in order for PHP to work with mysql. Again, from disk 3:
rpm -ivh /mnt/cdrom/RedHat/RPMS/php-mysql*
You now have mysql installed. To start it, again, using RedHat as an example, logging in as root:
/etc/rc.d/init.d/mysqld start
You should also at this point be able to pull up the PHP test page again and verify that PHP can talk to mysql by looking at the test page, and scrolling down to the mysql section. As always, should there be a problem started the mysql daemon, check the messages log as root (tail /var/log/messages). Remember that your command line client on Linux starts simply with the mysql command, that youll use the use command to load a database, or the show databases; command to display the databases available, and the grant command to add an account, and finally, that the sample database is called test. The terminal screen below shows a short mysql client session, a quick verification that everything is running, and a yet to be executed command to add a new user. At this point youve got everything in place to begin testing, though youll probably wish to begin creating your mysql database if you dont have one already. The online mysql documentation is quite comprehensive, and is located at http://www.mysql.com/doc/en/index.html
41
42
43
PHP/ADODB Applications
Think of your PHP application, therefore, as a browser-based interface to a powerful back end application. The Apache/PHP/ADODB platform has its strengths and weaknesses: Strengths: Your applications interfaces gain the advantage of being accessible from anywhere without requiring installation. They can be very scalable. The applications are secure, because the end user only sees the user interface, and the interface shows only the data you decide to show. The applications are manageable at a single point (the web server), and upgrades require no action on the part of the end user. The applications themselves can look very pretty and be very functional. The server itself, i.e., Apache, PHP and ADODB, can run on a huge number of server operating systems and be hosted on public servers with a minimum of effort.
Weaknesses: The applications look and feel different than desktop applications; issues such as window and thread management, and a restricted selection of window controls may be frustrating to some developers. The scripting languages, and the programming structure for them may not be as fully featured as other languages.
44
Database Access
In regards to relational databases, ADO Active Data Objects is an ActiveX interface to ODBC access. ADO also provides interfaces to non-relational tables such as Excel spreadsheets, in which case ODBC is not used. Using the templates, its not necessary for the Clarion developer to know the ADODB methods; however, they are important if you wish to understand the generated PHP code. ADODB works within PHP with the declaration of a connection object. The open method of the connection object takes the connection string as a parameter, and opens the database. The execute method of the connection object takes an SQL statement as a parameter, and returns a result set: an array of database values. As an example, Select FirstName, LastName from MyTable returns the values of all the first and last names from all the rows of MyTable. Using the resultset methods, such as next and previous, the developer can navigate through the database. The Clarion developer need not be concerned with ADODB code, unless you wish to be concerned. The template builds the necessary parameters. The template interface also generates the SQL code. These statements are exposed in the procedure properties dialogs; those Clarion developers with an excellent knowledge of SQL should feel free to modify the code should they feel they can make it more efficient. Clarion/PHP is designed for use with Client/Server SQL databases exclusively.
45
46
Configuring PHP
How can I make sure that PHP will find the ADOdb support source files, when my generated code has a statement such as include(adodb.inc.php)?
The PHP.INI file has an entry called include_path. You must enter in the string value all the directories where ADOdb support files are located. Each directory is separated in the string by a semicolon. For example, a typical entry in the PHP.INI for include_path may look like:
include_path = .;c:\php\includes;C:\ADODb;C:\ADODb\drivers;C:\PHP\Pear;C:\PHP\Pear\gopear-bundle
The drive letter in the string is the drive letter on the server where the files are located. Make sure that you always stop Apache and restart it after you edit your PHP.INI file. If the ADO database test fails from the test PROCS.HTM page, this path issue is most likely the cause.
Both default to 4096 in size. Adjust these entries to the biggest size an image can have.
47
How does PHP know what type of databases that it must support?
The PHP.INI contains 2 sections that need to be edited to add target database support. The first entry in the INI file that needs to be edited is:
extension_dir = C:\PHP\Ext
In this example, C:\PHP\Ext is the directory on the server where the PHP extensions DLLs (i.e., php_mysql.dll) are located. You need to enter the name of the directory where those DLLs are located. The other entry that needs to be activated is in the extension section. Search the PHP.INI file for this location:
;extension-php_myslq.dll
Note the semicolon preceding the extension entry. To activate this database, or any other database type for PHP use, remove the semicolon in front of the line corresponding to the target DLL.
Is there a simple way to keep all program images in the same place?
The best way is to create an Alias for the images in Apache httpd.conf configuration file. See the Configure Apache topic in this FAQ section for steps on how to create an alias.
48
ADODb
This section covers important install and configuration issues regarding ADOdb used with PHP.
49
Configuring Apache
How do I create a virtual directory using Apache?
In Apache, a virtual directory is called an Alias. The way to create an Alias is to edit the httpd.conf file and create an entry similar to this:
Alias /Orders C:/MyApp/PHP/Orders <Directory C:/MyApp/PHP/Orders> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory>
Case sensitivity is important! Double-check and compare your entries to other Alias entries already defined. Just make sure to stop Apache before editing the file and restart it when done. If everything is entered properly, you will be able to restart Apache, and it should now be possible to use Orders in the URL address to reach the directory specified in the Alias entry.
50
Deployment FAQ
What do I need to do in order to deploy my application generated by the Clarion/PHP templates?
The Clarion/PHP template generates all necessary files under the target application directory in a directory named PHP. Go in that directory and copy everything to the directory on the web server where the application should reside. Ideally, this will be moved in a directory to the server where an Alias statement was created in the Apache configuration file. If Apache and PHP are configured properly, your application will run as generated.
On the server, it is a good idea to have an Alias created for images, and in the PHP.INI, to have the include_path statement reference the appropriate ADODb directories. What this configuration, all you need to do to deploy the application is to create an Alias for the target directory and copy the files there.
What do I need to do in order to see the icons and images generated by the Clarion/PHP templates?
Create a directory for all images in the Apache root as follows: C:\Program Files\Apache Group\Apache2\htdocs\Images (Apache 2) or C:\Program Files\Apache Group\Apache\htdocs\Images (Apache 1) Next, copy all the PHP images from \Clarion6\Images\php\ directory to that location.
51
52
CLARION/PHP Users Guide Here is a bare minimum HTML page, consisting of a title, headline, a small amount of body text, and a text link to a page called other page:
<html> <head> <title>This Appears in the Browser Caption Area</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> <h1>This is the Page Headline</h1> <p>This is some body text. Every good boy deserves favor. All work and no play makes Jack a dull boy. The quick brown fox jumped over the lazy dog.</p> <p>The following text, where it says <a href="http://www.mydomain.com/pages/another_page.htm">Click Here</a> provides a text link to another page.</p> <p>And finally, the SoftVelocity logo will appear centered below:</p> <p align="center"><img src="/images/SoftVelocityLogo240w.GIF" width="240" height="127"></p> </body> </html>
53
PHP Language
The scripting language itself is derived from Microsoft Basic. Perhaps more important for PHP than the basic language elements and statements are the built in classes and objects for page and component access. Chief among these are the getRequest, getForm and Print statements, which refer to the incoming http request, values in any submitted form, and the outgoing http response respectively: the URL, parameters and posted data (fill in form data) that your PHP page receives, and the HTML page it posts in response. For example, if a form on the referring page contains a text box named FillThisIn, to retrieve the value that the end user typed in, the developer uses the method called getForm(FillThisIn). To write a string out to the clients browser containing the contents of a variable, the developer may use the statement Print($myvariable). (String variables must be prepended with a $ character. Scripts are enclosed in tags: <?PHP at the top of the file, and ?> at the end. Statements inside those tags must end with a semi colon character. Curly braces define statement blocks, and double forward slashes define comments. A global declaration script (YourAppNameappdata.app) declares the equivalent of global static variables; these store essential items not expected to change frequently, such as the connection string, and the values are loaded from the text file. Individual variables which are unique to each user are maintained via _Session structures. Those developers used to Clarion/ASP will be pleased to hear that PHP is more structured, and more like an ordinary programming language than just a scripting language. For instance, it provides for eight data types as opposed to the one supported by vbscript, used by Clarion/ASP. Clarion programmers only need to write PHP should they wish to customize the behaviors in the generated web pages.
54
55
Ch. 3:
Longtime Clarion developers used to working in the Clarion language may be startled to think of the Clarion application generator generating applications in another language, and indeed, on non Microsoft platforms. Clarion has generated database applications on DOS, Windows and IP platforms for nearly two decades.
Clarion has been the language of choice for the applications its created, though developers have had the option of incorporating C, C++, and Modula-2 source code modules. Clarion/PHP represents the first time the Clarion environment has been used to generate source code modules with no Clarion code targeted (as an option) for a nonWindows environment. Clarion/PHP provides a new option to deploy Clarion applications to browser-based users from public or high volume sites, utilizing the same elements: database dictionary, design-time interface, and application generator. Clarion/PHP creates Clarion type applications for browser clients/Apache servers.
56
57
Extremely flexible layouts via HTML run-time templates which can help you change any layout beyond the many options already available through the template interface. Clarion/PHP completely separates the application logic from the interface, making it a simple matter to turn the interface over to a web designer without worry that the customization will break the app. The web designer may modify anything and everything, so long as he or she cuts and pastes the symbols (for example @TableNameFieldName@) for each element to its new location. An enormous amount of flexibility via use of style sheets that work along with the PHP pages allowing you to define exactly the look you wish, and which allow you to blend the pages into an existing web using the same look and feel, and then automatically change the look whenever the site is updated.
The first guideline makes it crucial that you store as much information about the business rules and control pre-formatting in the dictionary as possible. The second implies you rely as much as possible on the global level options (via the dictionary and the Global PHP extension dialog) to set control behavior rather than on the window formatter. The only information that Clarion/PHP will pick up from your WINDOW structures is the list of available controls.
58
59
Security Levels
Clarion/PHP provides for a straightforward yet highly flexible security scheme based on a pyramid of user/group access rights with up to 100 user levels. When you enable security on a global level, each generated procedure will include a login routine. Access by the end user to any procedure page with security enabled will invoke a login screen. Once the user enters a successful login on one page, they may access any page their security level allows rights to, providing that any period of inactivity does not extend beyond a configurable timeout. If it does, they must log in again. You may designate a table within the database to store a user ID (we suggest that an email address is highly useful for general public web applications), password, and access level (an integer between 0 and 99). Optionally, the table may store the user name (either first and last names separately, or first and last combined), and an email address if not used for the user ID. The login messages/instructions are configurable.
60
CLARION/PHP Users Guide After specifying that security is to be enabled, and designating the table which holds the user information, the developer may then set custom access levels by procedure (the default for all, once security is enabled, is 1). Within each procedure, the developer may separately specify separate access levels for viewing, editing, adding, and deleting data. Thus, should the developer specify that ordinary users are level 30, supervisors level 50, managers level 70 and senior managers level 90, a developer may specify that a particular form might be viewed all, a new record added by supervisors and higher, an existing record edited by managers and higher, and deleted only by senior managers. With 100 possible values and four possible access levels per update form, the security system allows for many possible access scenarios. Additionally, implementing the global security table in conjunction with the My Records filtering, which allows you to designate a column as that particular rows owner allows you not only to provide for limiting access to the record only to an individual, but also to provide for security groups. By designating, for example, a department ID as the owner, you may effectively limit viewing and editing of data to only the members of that group. All traffic between the browser and the server is unencrypted and therefore open to packet sniffers, unless secure http (https) is used. Deployment of https is beyond the scope of this manual and is a matter for the web administrator.
Language
Clarion/PHPs default messages (e.g., Next record as a tool tip for the Next navigation button) are completely customizable. Weve provided sets of messages in three languages: English, Spanish, French, German and Dutch. Choose the language set in the global options, and if necessary, customize the messages further at either the global or procedure level. If you wish to customize the default prompts, edit the .TRN files in the Clarion template directory. Each of the files is named *LG??.TRN, where ?? is a two letter abbreviation for a language. EN = English, FR = French, and SP = Spanish. The file format is template symbol=text. Note that no % sign precedes the template symbol, that no space should exist on either side of the = sign, and the text string is unquoted.
61
Ch. 4:
Our Annotated Examples PDF included with this product provides very detailed instructions for creating the sample applications. We suggest that you use these as a starting point for working with Clarion/PHP. Most specifically, the Tasks example provides a quick and easy demonstration of significant functionality yet takes only a short time to complete.
62
63
Ch. 5:
How-Tos
The subsequent topics provide step-by-step directions for implementing Clarion/PHP for your business applications. The How-Tos cover preparation, application, testing, and Site Deployment/Integration.
Application How-Tos
Application of Global Template
This section provides and overview and describes the essential/required steps involved in applying the Clarion/PHP global template. A more complete description is available in the Reference section of this document. To apply the Global Template: 1. Open an existing application, or create one with the application wizard. 2. Press the Global button in the Application Tree dialog. 3. Press the Extensions button in the Global Properties dialog. 4. Press the Insert button in the Extension and Control Templates dialog. 5. Select PHP Global Template in the Select Extension dialog. The global extension prompts consist of eight tabs. These are all explained in the reference section of this document. Though all the tabs have important options, there is only one tab which must be filled in when first applying the extension template: Database Tab/Connection properties/Insert/Call Connection Builder Button: this displays the PHP DBConnection Builder dialog. Choose an access library on the DB Selection tab, and place the server and logon information on the Connection Parameters tab. Without this information, the web server cannot provide the ADODB libraries with the information necessary to access the data.
In addition, the Security tab may be considered by many to be essential. Please see the Global Options/Security Tab section for further information on security.
64
When applying the browse extension template, verify the unique key on the HTML Table tab contains the correct key information. Please see the Browse Options section for further information on the PHP Browse template.
65
You must verify that the Form Primary File and the Unique Key on the Data Access tab are filled in properly before you may save the form properties.
66
Browse/Form/Browse or Query/Browse/Form
If youve used the default Clarion template set to create an existing application for which you wish to generate PHP pages, your application is probably in browse/form/browse format. By this we mean that the top level procedures browse a list of records, and the end user locates a record they wish to edit. The end user pulls up a form, and if its necessary to navigate further, either to select a value in a related table, or to browse a related table, another browse appears. In general, web based applications start with a query form, for privacy reasons and/or to reduce the amount of data to be passed to the client (downloading a 1000 item product list vs. typing in a product name). SoftVelocity has designed Clarion/PHP so that it works equally well starting out with a browse, query form, or for that matter, a form. In the latter case, you must either start with a blank insert form, or pass a unique ID to the page if its an update. You set the unique ID field in the Procedure Properties dialog, and identify it in the URL as ID1. Thus, for an order form, whose unique identifier is the order number such as 12345, to directly open a form containing the order, the linking URL should contain a parameter in the form http://YourPageURL?ID1=12345. Clarion/PHP does not pass the name of the field, because that might compromise security. Note that in case of a multiple component primary key, the parameter format, for a two component key, for example, is in the format ?ID1=12345&ID2=67890 In general, you do not need to adjust your application at all. Browses and update forms will be generated with the parameters (or lack of parameters) that you specify. Its merely a matter of linking to the PHP page with the correct URL. The following are examples of the ways in which you can link to the PHP pages from either the top level contents page, from a frame, from any other pages (not produced by Clarion/PHP) at your site. You may combine as many of these access methods as you like. For the purposes of this example, the table is called Products, the procedure is called BrowseProducts (the table name figures into the page naming convention, e.g, the PHP file with the browse will be called /myapp/BrowseProductsList.php) a column containing unique values (strings) is called Product_Name, and a column containing duplicate values is called Category. Assume also that the category values are integers. Finally, assume that all URLs are encoded /myapp/filename.php. Normal Browse (no filter other than that defined in the template procedure): this is the default, so no actions are necessary within the template interface. The link is simply /myapp/BrowseProductsList.php. Note: Microsoft Internet Information Server is case insensitive.)
67
Browse (with a range select on one field): in the PHP extension template for this procedure, locate the Product Name column on the Table Data Columns tab. Press the Properties button. On the Column Header tab, check the box labeled allow calling this procedure with the value passed as a parameter. You may then filter by value, simply providing a parameter called ID1, as in /myapp/BrowseProductsList.php?ID1=Potatoes. Note that Clarion/PHP automatically distinguishes between numeric or string parameters in the URL parameter.
Assume that you wish to see all the product names in category 1. The URL would be /myapp/BrowseProductsList.php?ID1=1. Note that the general http format for passing multiple parameters within a URL is ?parameter1=value¶meter2=value¶meter3=value. Its important to note that you may only assign one field per browse table to filter the browse by ID1 parameter. If you also wish to filter by a single, different field, copy the procedure, rename the copy, and set the template option for the different field. If you wish to filter by multiple fields you may filter via a multiple component unique key, if one exists, or if not, a ?WHR parameter. To use a ?WHR parameter, the usage is http://mydomain/myapp/BrowseProductsList.php?WHR=dbo.products.price > 10. Bear in mind that this exposes your column names to the end user, who can see it in the address box of the browser. Query by Form: no parameter is necessary from the calling page. The URL would be /myapp/UpdateProductsSearch.php Blank Update Form: no parameter is necessary from the calling page. The URL would be /myapp/UpdateProductsAdd.php. Update Form for a Specific Record: simply use the unique ID1 value as a parameter called ID1. Thus, to call an update form for the product named Ford Model T Black, form the URL with /myapp/UpdateProductsAdd.php?ID1=Ford Model T Black.
68
CLARION/PHP Users Guide You simply have to decide whether to use the text value for a specific field for that link (for example, click on a last name to update a personnel record), or to accept the default graphic link, so that the end user locates a row they desire to edit, they click on the pencil either at the left or right of that row.
2. 3. 4. 5. 6.
When the end user clicks on a value in the column you selected, an update form will appear.
2. 3. 4.
69
2. 3. 4. 5. 6. 7. 8.
9. 10.
70
Examples
Update Form for a Specific Record: simply choose the unique identifier and use a value as a calling parameter named ID. To call an update form, the URL should be /myapp/myprocedureEdit.php?ID1=a unique ID. Dont include the period! The unique ID is the value corresponding to the column which was identified in the extensions dialog as the unique column. Note: a read-only or view form is also available which allows the end user to view the data without allowing for editing. The calling URL is identical except that the page name ends in View instead of Edit, as in /myapp/myprocedureView.php?ID1=a unique ID. Delete Form for a Specific Record: exactly the same as update, except that the page name will be different. Simply use the field name and value as a calling parameter. To call an update form, the URL should be /myapp/myprocedureDel.php?ID1=a unique ID. Dont include the period! Blank Update Form: no parameter is necessary from the calling page. The URL would be/myapp/myprocedureAdd.php.
A Query Page
Clarion developers often use the Browse/Form/Browse paradigm as a convenient way to allow the end user to type a few keys to locate the record they wish to edit. Providing a query page for this functionality is often a more useful strategy for Internet applications, in that its not necessary to download a page or table full of records in order to locate a specific record for editing. By displaying the form, the end user can type in an ID number or a few letters, view a list of records that match the query, and then choose one for editing. The Query by Form will use the same form layout as the update form, except for any fields you elect not to populate (by checking the Do Not Populate on QBF box on the form extension). The end user can type in a value or values, and any matching records will be returned in a browse, through which they can proceed to a view or update form. Note that in general, the less fields on the query form, the easier it is for the end user to use the query form. Additionally, this also prevents users from querying unindexed columns, which otherwise might slow the DBMS.
CLARION/PHP Users Guide Note: an unchecked check box instructs the query to test the field for a FALSE value. Leaving a check box unchecked is not equivalent no choice. To link to the query from an outside page, link to /myapp/myprocedureSearch.php. No parameter is necessary.
71
Browse to Browse
A Browse to Browse navigational link helps you provide a simulation of the parent/child browse functionality which Clarion so easily supports in desktop applications. Instead of providing two lists (or selects) in a single window, the child records of which update to reflect the values dependent on the key record selected in the parent table, in this case the end user only sees the child browse when they click or link in from a selected row in the parent table. By segregating the browses into two separate windows, Clarion/PHP reduces the amount of communications necessary between the server and the browser. The end user therefore clicks on a record in the parent table for which they wish to see the child detail. A new table appears with the child records. A navigational back button in the child table returns to the original parent browse. On the parent browse, be sure the PHP browse extension template has been applied. Verify that the primary column and the unique ID fields have been selected. On the child browse, be sure that the Data Columns options for the linking field includes the Range Limit on this column option, which is a check box option. Much like navigating from a browse to an update form, you must decide whether to link from a graphic, static text, or from a text value within a row of data. A browse to browse from customers to orders, for example, might simply say Show Orders, whether the link be text, or a button youve created as a .GIF displaying that particular text.
72 5. 6.
CLARION/PHP Users Guide Choose the Browse procedure for the Orders table in the Procedure to Link dropdown list and set the procedure to type list. Type in the name of the graphic in the Display Image box. Be sure to place the image in the images directory.
You still need to select an option on the child browse procedure. See The Child Side, below.
2. 3.
You still need to select an option on the child browse procedure. See The Child Side, below. Note also that you can provide a link on one column, yet pass data from another column, even from another table to the target procedure page. For example, you may wish to pass an employee ID number, yet the end user sees and clicks on only the employees name (which indeed may come from another table in a normalized database). You could also specify that the link provide the value clicked on as a parameter to the target browse, so that it may then range select on the value. For example, in a browse upon a product table, a column called Category could link to a browse on the Categories table, range selected to display all the other products in that particular category.
73
Select Browses
Wherever you populate a field in a form for which youve placed the Must be in Table option on the child table in the Clarion dictionary a button leading to a select browse will be populated. A popup list appears when the end user presses the button, and when the end user chooses a value, the popup will disappear and the value will be returned to the entry box.
Note that you may provide for a custom graphic for the lookup button should you wish. To enable the Select Browse procedure, you must manually choose the proper select browse for all the Must be in Table columns which appear in the update form; the procedures dropdown list will default to the first browse in the application tree. If you forget to make a choice, it is likely that the lookup button will display an entirely different browse in the popup, one which moreover contains no clickable fields from which to choose a value.
74
CLARION/PHP Users Guide You must also apply the browse extension template to the Select Browse procedure in order for Clarion/PHP to generate an PHP page for the select browse. When applying, you will then specify which value(s) to return to the calling form, and which display field the end user will click on to indicate a choice.
Experienced Clarion developers will immediately recognize this functionality from the File Drop Control Template. You may also specify one column for display, and another to provide the value to be written to the database. This is useful to display, for example, XYZ Corporation in the list that the end user sees, while writing 12345, the company ID number for XYZ to the normalized database. The developer need only specify in the dictionary the Must be in Table option on the child table, and then must populate either a FileDrop or FileDropCombo control template in the window.
75
In some cases it may be necessary to check the SQL statement generated for the select control, which is what a list box is called in the HTML specification.
76
CLARION/PHP Users Guide Note that for a small PHP application, you may wish to store all the help in one HTML file. You may then use anchors (e.g., http://www.mydomain.tld/myhelppage.htm#myanchor) to load the help page and jump to the section containing the appropriate help topic. Your HTML editor should allow you to insert anchor tags.
77
Testing How-Tos
Testing on Your Local Machine
If you have not already done so, you should install and test that Apache is running correctly on your local machine. Youll find instructions that will help you with this task in the Setup chapter of this manual If not using a local copy of Apache, once youve generated an application, youll copy all the files in the project\php directory and below to your web server, via ftp, samba, or whatever method is most convenient for your site. On the server, the simplest method of enabling access to the application is to create a directory under the web root and copying the files there. You may also edit the Apache configuration file, or create a soft link from the web root to a directory residing somewhere else (just be sure that the apache user account has access). If using a local copy of Apache on a Windows system, either create a new directory below your web root and copy the files there, or edit the Apache configuration file.
78
When testing locally for the first time, load the page, choose Edit > Find from your browser menu, and verify that each step detailed in the document succeeded. If any step failed, the document tells you the most probably causes. In general Any problems documented in the first section indicate a problem with your database connection settings. Any problems documented in the last section indicate a security settings issue. Any problems documented in the middle indicate a database connection problem specific to a table or view.
After a successful connection, begin testing the procedures. Some may appear blank, but this is normal and only indicates that it is a filtered procedure and may require a parameter. For more information regarding this, see the Links on page 83 in this PDF.
79
Integration/Deployment How-Tos
HTML Template
Though it may seem that everything is being called a template, Clarion templates and HTML templates are different things. This focuses only on the HTML templates. There are two types. One is a design time template, which is used only at the code generation step. The other is a run time template, which is used every time an end user requests a page. Design Time HTML Templates: all the PHP code that Clarion/PHP generates for data access is a combination of HTML and PHP pages and headers, all processed by the PHP module, and placed in-between the top of a page and the bottom of a page These tops, bottoms, and sides are your HTML design time template. You or your web designer will without a doubt wish to create your own HTML design time template. Because the Clarion/PHP data elements are of a reasonable size, they should fit well into a site with or without frames. Clarion/PHP merges the data access elements into the pages it creates at the time you generate the pages. Therefore, you should plan on copying your HTML template to your development machine.
This HTML file must reside in a directory called html, directly below your application project directory. You must create the directory and copy the file there. (Note: this is not to be confused with the project directory\php\html directory, which is an output directory). Use any standard HTML editor to create your template page. At some point within the page, be it top, middle or bottom, at the place you wish Clarion/PHP to insert the code it generates (i.e., the place where you want your browses, forms, etc., to appear), place the text @Clarion/WEB@. (Dont type the period at the end of the sentence). You must type in the name of your template in the Global Options dialog for the PHP extension, in the field called HTML Template. You may use the tops and bottoms to provide a place for company logos, site navigation, privacy or other important statements, ad banners, or anything else, including links to various Clarion/PHP generated procedures.
80
CLARION/PHP Users Guide Many sites use HTML includes to create standardized page sections. You may include these in the HTML template, so that the Clarion/PHP pages will be as easily maintained as the rest of the site, and will be standardized in look and feel. Run Time HTML Templates: after youve chosen your template, when you first generate your application it produces additional HTML files for your other procedures. These are also editable. In essence, these runtime templates are the setting for the individual data fields and prompts. Each data field, prompt, or element such as the navigation buttons has a symbol which appears in the runtime template.
When the end user requests a page, the PHP code resolves the request for the data, gets the data, opens the runtime HTML template, replaces each symbol with the appropriate prompt or data, and that page is then delivered to the end user. In the browse procedures, for example, you will find tokens in the format @TablenameFieldname@ occupying the table. Each token stands for the data which will replace the token. Should you wish to modify the layout, you may modify the html page. You may not add or remove tokens. This therefore means that you may further customize the layouts at this level as well. Bear in mind that these HTM files are regenerated. Turn off html generation at the procedure level should you wish to make changes and keep them, or set the file to read only.
Style Sheets
HTML style sheets, known as cascading style sheets (because one style may cascade its characteristics into another, and so forth), play a large role in many sites, and a large role in the Clarion/PHP pages. The style sheets declare classes, which consist solely of formatting instructions. You can then apply the style to a tag (be it a paragraph, cell in a table, a table, etc.), and that element will then be formatted according to the instructions in the style sheet. This allows any site to greatly change its look simply by substituting a new style sheet for an old one. Clarion/PHP allows you to define styles for elements such as table column headers, update form control labels (prompts), data rows, etc. When you create the style sheet, you may wish to set their options so that they mimic the color, font, and formatting choices of your site. Should your site subsequently modify its style sheet, simply update your Clarion/PHP style sheet to match. Youll find more information on Clarion/PHPs use of style sheets in the chapter devoted to the style sheet editor. Note also that web designers may edit the style sheets using appropriate utilities or a text editor.
81
In this case the action points to the next page that should appear after submitting the form. Simply change the file name in the action tab to a different page in order to post the form data to that page and display it to the end user.
82
CLARION/PHP Users Guide In the above example, changing the action page is as simple as:
FormDeclaration = "<form name='form1' id='form1' method='POST' action='/mysite/otherpage.php'>"
(Note that the PHP page will be regenerated the next time you generate the project! When you must edit the .php page, set the file property to Read Only using Explorer). The otherpage.php may then process the posted data, though the developer must inform the web administrator of the names of the form fields. The formula for each form field name is the $txt + TableName + Field Name. If the table name is called Customers, then the field names for the fields FirstName, LastName and CustomerNumber would be txtCustomersFirstName, txtCustomersLastName, and txtCustomersCustomerNumber, respectively. By referring to the Clarion/PHP produced HTML equivalent of the PHP page (in the html directory below the PHP page), the web developer may easily view all the form field names.
83
Ch. 6:
Its anticipated that most developers will use Clarion/PHP to produce a small number of data access enabled web pages to fit into existing sites. For these developers, the following steps will be necessary: Manage the look and feel so that the Clarion/PHP pages fit perfectly into the site, and may be easily maintained so that overall site updates will not leave them behind. Correctly integrate links to and from various site pages and other applications (insofar as these are consistent with the rest of the site). Test that at an operating system level, the files (ftp uploads, access to the database, directory names, securities and permissions) are correct. Verify that the server resources are adequate for the application. Verify that security is adequate.
Links
Links are the conduits through which one page leads to another on the Internet. There is no program flow like a desktop application. An important concept for database developers to grasp about PHP is that, like web pages, the browser and web server do not maintain a continuous connection (its stateless). Further, the web server and the database do not maintain a continuous connection per each user. For this reason, the links on the procs.htm page generated by Clarion/PHP can be used from anywhere within the site, or from anywhere within the Clarion/PHP pages. The only limitation is a logical one: if you wish to display a form containing only one record, or display a filtered browse, you must supply a way to identify the record(s) within the link. You can do this as a simple HTML parameter. The parameter will always be called ID1 (plus ID2 if a multi component key). The field it refers to will be the unique ID field which you defined for the procedure extension. Note that though the procs.htm page generated by Clarion/PHP is not meant to be a table of contents for end users (its intentionally kept very plain), it does provide a handy reference to the page names you may wish to link to from other parts of the web. Its primary purpose is to provide the developer with a quick way of testing the Clarion/PHP generated pages.
84
Persistence of Data
Its important to understand that each time a Clarion/PHP page makes a request to the database for data, PHP creates a new connection object, gets the data, and closes the connection object. The only persistent data lingering from page to page are the application data and session variables, which solely reside on the web server. This is limited to a unique ID maintained by Apache for each users session, plus the session variables that Clarion/PHP declares. When, for example, a user opens a browse, PHP creates a connection object, queries the database, receives a result set, sends some number of rows to the end user, and closes the connection object. Therefore, if youre a developer thinking about program flow, and worried that youre leaving an open application behind if you jump from a browse to a completely different browse: theres no need to worry. In fact, even if the user jumps from a browse to a completely different part of the site and never goes back to the application, all that happens is that the session will eventually time out. Leaving an application open does not waste a large amount of resources: at worst, it requires a few session variables and perhaps a cached result set on the web server. Note also that you have control of the timeout value. Here are the main points to understand so that you can link into any part of the Clarion/PHP pages from inside or outside the pages:
CLARION/PHP Users Guide Finally, please note that *nix servers are case sensitive; differences in capitalization will lead to a broken link.
85
Linking Conventions
Reminder: to pass a parameter via URL append ?ID1=value to the URL, where the value is the value of the unique ID column. In the examples below, were assuming links relative to the root of your site. Note that link text is the text that the end user sees and clicks on to arrive at the page. Browse, no filter: URL only, such as: Browse, filtered: URL plus unique field value as parameter, such as: Query form: URL only, such as: Update form, new blank record: URL only, such as: Update form, update a specific record: URL plus unique field value as parameter, such as: Update form, delete a specific record: URL plus unique field value as parameter, such as: Update form, view a specific record: URL plus unique field value as parameter, such as:
<A href="/path/clarionbrowseprocedurenamelist.php">link text</A> <A href="/path/clarionbrowseprocedurenamelist.php?ID1=1093">link text</A> <A href="/path/clarionupdateprocedurenamesearch.php">link text</A> <A href="/path/clarionupdateprocedurenameadd.php">link text</A>
86
CLARION/PHP Users Guide In Clarion/PHP, we call this a design time template. All that you need do is open the template, insert the symbol @Clarion/WEB@ in the spot where the template normally places the fill in text, and save an HTML file to the project\HTML directory. Then in the Global Extensions, declare the page as your design time template. At generation time, all Clarion/PHP generated elements will appear in the place in which you put the symbol. With apologies to the very popular site whose page was borrowed for the example below, this represents what happens when you take an existing page and place the @Clarion/WEB@ symbol inside it. Note that the colors in the style sheet were designed to mimic those in another table found at the site:
87
The global tab allows you to set the look and feel for the generated pages, using HTML templates and style sheets. It provides access to dialogs that allow you to customize all the prompts and messages (except for the help text pages, which you must write separately, of course). It also allows you to specify debug mode.
88
CLARION/PHP Users Guide Because all the messages are set in the template, it makes it simple for you to customize your applications for specific languages. You may override your global options at the procedure level. Note that when you check the option to override in a procedure, should you change a global option afterwards, the global change will not affect any of the options in the changed procedure.
Target Language
All default Clarion/PHP help and prompt messages (not including the prompts in your dictionary and application files, of course) are provided in English, Spanish and French. Typically, these messages are basic instructions, such as Add a record. You may override all these messages at the procedure level. To choose a set of prompts, select English, French, or Spanish from this dropdown list. If you wish to customize the default prompts, edit the .TRN files in the Clarion template directory. Each of the files is named *_LG??.TRN, where ?? is a two letter abbreviation for a language. EN = English, FR = French, and SP = Spanish. The format is template symbol=text. Note that no % sign precedes the template symbol, that no space should exist on either side of the = sign, and the text string is unquoted.
Tooltips
Clarion/PHP generates ALT text for its button images, which are displayed as tool tips in Internet Explorer (ALT text only displays in other browser if the image is missing). You may enter the following tool tips: Help Link: default text is Help. Back Button: default text is Back.
89
All the data controls generated by Clarion/PHP will appear within a page you specify. This is convenient, for example, for placing a navigation bar at top, and other elements below. The Clarion/PHP elements are not limited to the top or bottom. This HTML file must reside in a directory called HTML, directly below your application project directory. You should think of Clarion/PHP as responsible for generating only the data elements and/or data access related messages, and your HTML design time template to provide a setting in which these elements appear.
90
CLARION/PHP Users Guide Use any standard HTML editor to create your template page(s). At some point within the page, be it top, middle or bottom, at the place you wish Clarion/PHP to insert the code it generates (i.e., the place where you want your browses, forms, etc., to appear), place the text @Clarion/PHP@. (Dont type the period at the end of the sentence). You may use different templates for different types of procedures: list (browse), form (update), global (all others). Press the button and enter the file name for your template(s). You may specify separate templates for browse lists, select browse lists, forms, and all others (help, index page, any choices not filled in). Note that you may override the default template at the procedure level.
List Defaults
The list defaults set the global options for the amount of rows to show in the list boxes, whether to place a navigation bar in the list, navigation bar options, and tool tips related to list boxes. Press the button to display the dialog, and enter your preferences in the dialog.
91
92
CLARION/PHP Users Guide Note that the browses are page loaded; each page will display as many records as you set in the Data Records per HTML List box, above.
93
94
CLARION/PHP Users Guide Additionally, you may specify the tool tip for the next and previous buttons by typing it in. The default text is Previous Record, and Next Record, respectively. You may also define a custom message to display when the end user presses the next or previous button after reaching the last or first rows, respectively.
95
These allow you to specify text for the form buttons; both for the button text, and for the tool tip text (using ALT). Enter your preferred text for the Submit, Reset, Delete, and Edit buttons and their respective tool tips.
Status Text: a label before the text that describes the current process to the end user (i.e., te word Status in Status: Updating a record. Record Not Found: a ID field for the form did not match a row in the database. Return to List: a navigational aid. Return to List from Search: a navigational aid. Insert Failed: ADO was unable to add a new record. Insert Succeeded: a new record was added.
96
CLARION/PHP Users Guide Update Failed: ADO was unable to edit and save a value in an existing record. Update Succeeded: ADO was able to edit and save a previously existing record.. Delete Failed: ADO was unable to delete a record as requested. Delete Succeeded: ADO was able to delete a record as requested. Delete Confirmation: asks the end user if theyre sure they wish to go ahead with a deletion.
97
The options on the Generation tab allow you to optionally specify and control the additional non-PHP pages be generated when the Generate All command is executed, and whether the resulting PHP pages should enable debug mode.
98
CLARION/PHP Users Guide In debug mode, Clarion/PHP passes all Apache, PHP and/or ADO errors through to the page. In non-debug mode, Clarion/PHP attempts to provide a friendly explanation. Note also that the Test/Debug page described in the Testing on Your Local Machine section is also an efficient means of testing the critical parts of your PHP application.
99
.htm pages to custom format or change the layout of control elements. After editing, suppress HTML Pages generation so that the next time you generate the project you do not overwrite your customizations. Help Pages: Clarion/PHP automatically generates skeleton pages for your help text. These pages contain formatting according to your style sheet options, and JavaScript functions to automatically size the popup windows, which appear when the end user presses the help button. To add your text to the help pages, simply open a page in a text editor and type your text in the line that says, Customize your help text here. For large blocks of text with complicated formatting and/or illustrations, we recommend loading the skeleton help files into an HTML editor. Once youve created the help files, suppress help page generation so that the next time you generate the project you do not overwrite your customizations.
Miscellaneous Box
Using Access Database: checking this box (Windows servers only) specifies that Clarion/PHP should generate non-standard SQL for use with the Microsoft Jet Engine. SQL String Delimiter: should your database require it, you may specify the double quote character instead of the default single quote character for delimiting string values.
100
CLARION/PHP Users Guide SQL Date Delimiter: should your database require it, you may specify double quote or pound sign characters instead of the default single quote character to delimit data values.
101
The DB Selection tab is straightforward: simply pick a database from the list. The following note provides additional information: Use the checkboxes at the top of the dialog to filter the choices in the list. Remember that ADODB is cross platform. If your Apache target is *nix, then you do not wish to use ODBC or ADO, and have no need to view those choices. If your Apache target is Windows, then you will very possibly use them. In general, if your target is *nix, check only Unix and Native Client DLL. If your target is Windows, check Windows and all three of the layer check boxes.
As you look through the choices in the list itself, youll note that X marks each columns support or not for that particular target OS or access method.
102
CLARION/PHP Users Guide Note that for normal mysql support, choose mysql; not mysqld. The latter is for mysql installations using non default types, such as InnoDB, which provides transaction support with mysql. These are usually not installed as defaults by most Linux distributions. Note that for ADO support (Windows target only), the ADODB libraries automatically manage all ADO options. In general, if you wish to use ADO, youre probably better off using the Clarion/ASP product. The functionality of ADO to MS SQL Server is limited; we recommend using Clarion/ASP and IIS/ASP to connect to that database. If you must use Apache/PHP, we suggest using the native dblib; however note that this option does not support unicode data types. ODBC support in for Apache/PHP/ADODB/Windows is good.
Connection Parameters:
This tab allows you to input the specific server and login information necessary to access the database chosen on the DB Selection tab.
Server/DNS: enter the name of the server on which the DBMS resides. If targeting Windows/ODBC, you will instead enter the DSN. Runtime User Name: enter a user ID which PHP will use to log into the database. Runtime User Password: enter a password which PHP will use to log into the database.
103
Note: This password is different than the security built into Clarion/PHP. Clarion/PHP must have access to the database first, in order to check the user/password tables which are stored in the database. The end user does not have access to the runtime user/password, as per the description of the DSN options, above. Database: enter the name of the database to be used by your application.
104
Data Connection
This dropdown control allows you to select the connection object used for the security tables.
User Table
Select the name of the table within your database containing the security information. All fields should be character fields, except the user password column, and should contain at least the following structure: one of FullName/FirstName + LastName/Email Address, set as a primary key. A password column and a security level column should also be included.
Unique ID Column
Select the name of the primary key column, or another unique key.
105
Login Persistence/Cookies
Cookies are ASCII files stored on the local drive of the end user, allowing you to save variables locally, for retrieval the next time the end user logs visits your site. Clarion/PHP allows you to store the user ID/password in a cookie, so that the end user, whenever logging into your application from the same machine in which they stored a cookie previously, can automatically login without having to type the user ID and password. You may store the user ID only, or both the user ID and password. Check the Allow saving user identifier as cookie box for to store the user ID, and optionally, the allow saving password as cookie for the password. You may also set the text for a message which prompts the end user to decide whether to store the information or not. The default text is Save Information. Note, of course, that should the end users browser security settings prevent the ability of your site to store cookies that the cookie will not be created. The default expiration time for the cookie is December 31st of the current year; this is (more or less) a standard. No option is provided in the design time interface to change the expiration time; if this necessary for your site, you may edit the login.php page (search for the string mydate). Additionally, please note that the user name and password are stored as plain text within the cookie file.
106
Fill in the following text: Login Prompt Text: (self explanatory) Instructions: text to explain the login procedure Bad User ID: text to notify the user that the login failed Bad Password: text to notify the user that the login failed Insufficient Access: text to notify the user his security level is lower than that required for the page they requested Enter Retry: text to instruct the user how to retry the login Submit and Reset button labels: (self explanatory) User ID and Password prompts: labels for the text boxes in which the end user enters the information.
107
Site Title
Fill in a string that you wish to appear in the top frame of the Clarion/PHP generated index page.
108
109
Images
The Images tab allows you to define the location of the various button images which will appear in your pages. The labels for the template prompts for these images are self explanatory. Note that several buttons provide for two images: one enabled, one disabled.
110
Image Sizes
Its assumed that all your navigation and help icon images will be the same size. You may enter the width and height in pixels here. If they are different sizes, enter zero and zero. It is to your advantage to enter the pixel widths, else the browser client may redraw the table after completing the entire download. Note: the back and help buttons are not affected by this parameter. You may also specify a border size in pixels for the images.
Should you wish to substitute your own .gif or .jpg images, feel free to locate the button image you wish, and change the file name by either typing a new file name, or pressing the ellipsis button to browse for an alternate file. Dont forget to copy your custom images to the images directory on the web server.
User Data
This tab allows you to define user variables for use in embedded code. Please refer to the chapter on Embeds for information on embed points and PHP. Once you define a variable, you are responsible for adding the symbol name (in the format @symbolname@) to any HTML runtime template that you wish to display the variable. Or you may optionally name a custom control with the same name as the variable, and Clarion/PHP will generate the symbol into the runtime template. When you define a variable name, AppGen will automatically declare the variable at run time, in the appdata.php page. It is the developers responsibility to put the symbol to use. To add a variable, press Insert, and type the name of the variable into the User Data dialog. We suggest prefacing any user-defined variables with a distinct preface, such as ud_, in order to distinguish them within the generated code. To edit a variable name, select the variable in the list and press the Properties button. To delete a variable, select it and press delete.
111
Includes
Includes allow you to specify external files which will be merged into the document at the time the end user requests it. Because this is a somewhat advanced topic, weve provided a separate chapter to explain the process and its usage. Please refer to chapter 9 in this manual for further information.
112
113
Please see the Global Options section for specific explanations of the above options, except Includes, for which you may refer to chapter 9. Row Style: to specify conditional row formatting, press the Row Style button (see Conditional Row Formatting, below). When set, the row is set to one style if it meets the condition, and another if it does not. Note: you must already have defined at least two data row styles using the Style Sheet editor to specify conditional row formatting. Security: the Enable security for this procedure checkbox option allows you to turn security off for this procedure. Note that the checkbox is only available if youve turned security on at the global level. Additionally, by overriding the global security option you may add My Records functionality, as explained below.
Press the Row Style button and then fill in the following options to provide the desired behavior: Default Row Style: select one of the Data Row Style Options you previously defined in the Style Sheet as the default row formatting. Default refers to the formatting for the odd rows should you choose a greenbar option, or the rows
115
that dont meet the condition if you choose conditional. The options appear in a drop down list. Use Additional Row Style: select either No, Greenbar, or Conditional. No indicates that you wish to use the row style selected above for all rows, without condition. Greenbar specifies that you wish to alternately format rows using two styles (and neither has to be green). Conditional selects one or the other row style dependent upon a field value, chosen below. Additional Row Style: select the other row style. This will format either the even rows (greenbar style) or the rows that meet the condition. Column to Test: when specifying a conditional option, select one of the fields in the browse to test, by choosing from the drop down list. Operator: choose an operator for the test from less than or equal to, equal to, not equal to, or greater than or equal to. Value: enter the value for the comparison.
My Records
The Clarion/PHP My Records support allows you to specify ownership of records by user. Each user then views and edits only those records for which they have ownership. The general process is as follows: At login the end user uniquely identifies themselves. This is stored in a session variable (usually, UserEmail is used, because many sites have adopted the email address as a common identifier; its unique to each person and easy to remember). When the user adds a record to a My Records update procedure, one of the table columns receives the session variable (email); this is done without showing the field on the form. In a browse procedure, a filter is placed on all records limiting the rows viewed to those with the email (or other session variable) in that particular column. Similarly, delete, search and view form procedures limit their scope to the users records.
116
CLARION/PHP Users Guide To enable all this functionality, first turn security on globally. You must enable My Records support on a procedure-by-procedure basis (both browses and forms). Then, to enable My Records on a browse, check the Override box on the Browse Options Globals tab, and then fill in the Security sub tab, as described in the following section. To enable My Records filtering, as described step by step: 1. 2. 3. Check the Enable Security for this Procedure box. Check the Enable My Records filtering box. Select the data column which is to store the user information to test against. This column should be present in the browse procedures primary table. When you design the database, be sure to provide that your master security table and any tables you wish to provide My Records support for all include a field of the same data type and length which you will use for these purposes. You may name the columns whatever you wish; you need not specify the same name for the column in every table for which it appears. Select the session variable to test against it.
4.
In many cases, web sites use an email address as a unique identifier. Clarion/PHPs global level security dialog. Therefore in many cases, youll simply pick the UserEmail session variable. You may use the My Records variable to flexibly filter records, not only by user, but by type of user (allowing for access by group), as in the following examples: The Northwind sample databases employee table contains a reports to column. You may filter a browse which allows managers to see only their direct reports by specifying the reports to column as the data column to compare, and using the employee table as the security table, the employee ID as the user ID, and then using the UserID session variable to test against the reports to column. Similarly, you may declare an additional session variable, such as Department, edit the login.php page to assign the session variable based upon department data which you would store in the security table, and then choose that session variable to compare to a department value in your primary browse table. You could similarly substitute region, sales territory, etc.
Once youve correctly set up the My Records options for each procedure, you need do no more; Clarion/PHP automatically hides the necessary fields, applies the necessary query filters, and takes care of setting the data defaults for new records. Note that should you be applying the functionality to existing data and are adding a column to a table that you must add the values necessary for the existing records, else they will not appear within any users My Records filter.
117
Finally, note that you may place My Records on a form yet not place it on a browse, due to the fact that each procedure within Clarion/PHP is isolated from the other due to the nature of the web. This means that you may allow an end user to view all records within a browse, but restrict editing, deleting, or viewing details to each owner by placing the My Records filter on the form. This, as an example, could be useful for sales personnel allowing only an owner to see the account details, but allowing everyone else to see an account summary.
118
Page Title
This allows you to specify the name of the page, as it will appear in the caption bar of the browser.
Help URL
This specifies the name of the help page. Note that this assumes the page is located in a directory called help one level below the PHP page. The help text appears in a popup window when the end user presses the help button in the browse. You must produce the help text using an HTML editor. The popup help window sizing is specified in the global options.
QBF Procedure
Select an update form in the application tree to provide a basis to lay out the QBF form. This allows the end user to see a familiar form, and enter the data to search for in the form. After filling in a QBF procedure, the end user will view a browse containing records that match the query, and can then, if youve provided a link to a form within that browse, view or edit an individual record by selecting from the browse.
Add Procedure
Specifies the update procedure for the record. Choose from the dropdown list.
119
Select browses can be called with an optional range select or a ?WHR clause. No action is necessary in the browse side of the template interface. You may set the range select from the update side, by selecting a field on the update form, and a field on the select browse. This will call the select browse with a WHERE limiting the browse to only those rows in which the column matches the current value of the field on the update form. See the instructions for the Update/Controls/Validation tab, Must be in File option.
Populated From
This specifies the browse control within the window contained in the procedure. The dropdown list displays the FEQs (Field Equates) of any browse boxes it finds. Remember that the template limits you to the display of a single browse; however, its easy to provide a link to a separate browse. Clarion/PHP allows you to select a browse that may include fields from more than one table. It will automatically generate the proper JOIN syntax necessary. Note: if when debugging your application a browse composed of fields from multiple tables creates an error, but browses from single tables do not, examine the SQL select statement, copy and paste it into an SQL command line tool provided by your database vendor, and verify that the syntax is correct for that particular database. If not, you must customize the SQL statement (see below).
120
Unique Key
This allows you to select a key to uniquely identify each record. If you pick a key allowing duplicate values, the procedure will return with a not found message. This box will default to the key in the dictionary with the primary attribute.
121
To un-apply the query filter, the end user may press the All Data link which appears in the caption area whenever a query filter is active. After returning from the locate query, the browse will reflect the query that existed before the end user typed anything in the locator box. Note that if the end user types additional text in the locator box when a query is active, the new query will be applied only against the results of the previous query.
Locator Column
This allows you to specify a search column by choosing a field from a list. There are four items to note: For best performance, the search column should be a key component, or an index should exist. In the case of a string search, the search clause will take the form where searchfield like WhatTheUserTypes% which means that if the end user types in A, then the search will return all values beginning with the letter A. Any end user searches will append an SQL where clause to the clause which populated the browse. If, for example, the original browse page included a filter such as State = NY, and the search was for CompanyName like A% then the search page results will be for State = NY and CompanyName like A%. The resulting search page will include a link back to the previous browse. You may specify the precise text that the end user sees for this link (the Clear Filter Prompt on the Messages tab of the Global and/or Page Overrides). The default text is All Data. The resulting page will include any previous filter that was in effect for the page prior to the search; therefore if your browse includes a default where clause or other filter, its recommended that you change the text.
Final Note: should you wish to duplicate the functionality of an end user search, calling the search results page from outside the Clarion/PHP pages, you may use parameters:
BrowsePageURL?Locate=TRUE&Field=FieldName&SearchValue=SearchValue"
In the example above, note that the browse must have a Locator specified for the field named.
122
Regenerate SQL
Should you insert or delete any of the columns on the Table Columns Tab (below), the template will regenerate the SQL for the browse select only after closing and reopening the Procedure Properties dialog. Some developers therefore may wish to immediately press the Regenerate SQL button after making a change to the table column list, should they wish to check the generated SQL. Note, however, that should you edit the SQL by hand, then add or delete a column from the list, Clarion/PHP will not change your hand-edited SQL; you must either change your SQL statement by hand, or press the regenerate button (and then re-do your customization).
123
124
In general, you should approach the inclusion of data in PHP browse tables more conservatively than desktop applications. When serving data over the Internet, it may be more helpful to limit the number of columns in a browse, which results in less time waiting for network transfers and a more readable page, than including many columns. Clarion/PHP makes it easy to provide a view link, so that the end user needs only to click once in order to see a page containing an update form, showing all or most fields, and the page may be opened in view only mode, disallowing changes to the data. Moreover, remember that these are HTML tables, not list boxes with horizontal scrolling capability as in a desktop application. Therefore, populating a browse table with many, many fields is liable to result in very narrow columns, compromising readability of the data. You can, however, group a column with the data from a previous column, in effect making a cell into a multi line element. Place an HTML <br> tag in-between the fields to provide this stacking effect. Place the HTML code for a non breaking space, which is nbsp; including the semi colon, to place two fields together with a space between them.
CLARION/PHP Users Guide The illustration below contains multi-line data for the Company column. All fields following company were specified as grouped with the previous field. The <BR> tag precedes the first name, title, and address line 1, and city fields. the nbsp; keyword precedes the last name, state, and zip code fields.
125
Additionally, note what we think may become a common error for experienced Clarion programmers: when adding a date column, do not include the date component of the Clarion group which the dictionary import procedure automatically places over the date/time field. Use the date/time field. A simple way to detect this is to scan the data columns list for any column named columnname_DATE, since the import automatically appends the _DATE at import to the Clarion date field. The SQL date/time field should by default not have the _DATE appended to it, and should have a picture of @s8. The Data Columns Properties dialog allows you to specify both appearance and functionality for the data in your PHP browse columns. The dialog is divided into tabs.
126
Checking this box will allow you this browse to be called with a range limit/filter, such as Where columnname = parameter value. The browse will then display only those records which match the filter. This allows you to match the functionality of a Clarion parent/child linked browse box combination in PHP (spread across two pages). To enable such a link, check this box in the child browse. Be sure to check this box for only one column. You can also easily create a browse to browse link, by specifying that your field be a procedure link, passing the value of the range limiting field, choosing the other browse procedure, and specifying List for the type of procedure. (see the Appearance tab, below). Once the child browse is configured with the range limit option, you may also call it from any other page on the site by passing the ?ID1= parameter with a range limit value. You may also create the same functionality a different way; from the parent browse, add a custom link on the table data columns or static columns tab, and include the field value as a parameter to this page, passing the value of the current row of the current field (for example, http://www.mydomain.com/browsepagename.htm?ID1= . Request(Customer_ID)). Note that the first part of the URL is double quoted.
127
Once youve added this option, you must insure that all calls to the browse page include the ?ID1 parameter. Should you check this option, and then later uncheck it, you must manually edit the Where clause on the Default SQL tab. If the template were to clear the clause, it might also delete any customize SQL you had previously placed in the Where clause as well.
The Hyperlink group box allows you to specify that when the end user clicks on a data item in this column, the browser will open another page. To enable the link to open an update procedure (or another procedure, for that matter), check the Procedure Link box and specify the name of the procedure from the dropdown list. Remember to apply the PHP form procedure to the procedure you select. Indicate in the second dropdown box the action to apply to the procedure: whether its to view data only, or to add, edit, or delete a record, or to list data, as in the case of opening up a browse on a child file.
128
CLARION/PHP Users Guide The Custom Link choice allows you to add an HTML or JavaScript link in the Custom Link edit box below. You must provide the text of the complete link, from the <A> to the </A> tag, as in, <a href="URL">Link Text</a>, or <a href="URL"><img src="Image.GIF"></a> Create column as a Link: optionally specify the link type (procedure or custom). If not a link, the table merely displays the data as static. The default choice is No. Pass this Data: allows you to define which value to pass. choose Key Value, Data Column, Session Variable, or Static Entry (text). Your choice will enable one of the following four controls. Key to Pass: allows you to define which key to pass the value(s) of. This allows you to link to a form on a table with a multi component key. Data Column to Pass: allows you to define a link on one column, yet pass a link value from another. For example, to allow an end user to click on a product name, but to pass the product ID as a parameter to a product update form. This can be combined with hiding the Product ID in the browse, making the operation friendlier to the end user. Session Variable to Pass: allows you to define a session variable to pass to a procedure. Static Entry: allows you to pass a string to a procedure. Additional Parameters: allows you to pass additional parameters when specifying a procedure link with static entry. Fill in the format parametername=value, or parametername1=value1¶metername2=value2. Procedure Link: to enable the link to open an update procedure (or another procedure, for that matter), check the Procedure Link box and specify the name of the procedure from the dropdown list. Remember to apply the PHP form procedure to the procedure you select. Indicate in the second dropdown box the action to apply to the procedure: whether its to view data only, or to add, edit, or delete a record, or to list data, as in the case of opening up a browse on a child file. Type of Procedure: specify the type of Clarion/PHP the target procedure is (list, view, add, edit, or delete). Custom Link: allows you to add an HTML, PHP, or JavaScript link in the Custom Link edit box below. You have complete control of the link, which means that you may specify custom tags such as Flash files. The link will also not automatically display your data; you must manually place it.
CLARION/PHP Users Guide Your code must include the <a> and </a> tags. Its important to note that the text you enter in this box will be temporarily stored in a string variable, and therefore will be surrounded with double quotes. The code surrounding yours enclose it with double quotes, as in:
mylink = <a href=/HomePageContent.htm>this is some text</a>
129
When using a custom link for the data column, the value of the data column does not appear in the browse table unless you place it there manually. In general, the only reason to use a custom link for a data column instead of creating a custom column (see below) is if you must include a custom link in between columns, rather than at the left or right of the table. Please see the section on custom columns, below, for further information on creating the actual link text for data columns acting as custom links.
130
Column Header Text: the text you wish to appear at the top of the column. Enable Sorting by this Column: allows the end user to click on an image on the column header to sort the column. Note that the default is sortable for all columns, but in general, good DBMS management suggests that its best to remove the sort capability from columns not part of any key components or for which theres little rationale for allowing a sort. Ascending/Descending Sort SQL boxes: the template automatically includes ORDER BY clauses (one for ascending, one for descending) in the text boxes below. Note that you may manually override the default by typing in your own clause.
131
Ascending/Descending Sort Images: the image files used to add a directional icon for the sorts.
Alignment: because all data in the HTML form is a string, the cell alignment options are left, center and right. Width: this allows you to set a custom width (in pixels or percent) for this column. Bear in mind that should the totals for all the columns exceed either 100% or the available space in pixels, the browsers rendering engine will adjust the column size as necessary.
132
CLARION/PHP Users Guide Formatting Function: In the same way that you may specify conditional formatting by style for rows, you may specify conditional formatting by style for columns, in effect allowing you to highlight specific grid cells based on the data value. Simply check the box, pick a style and specify the condition.
You may format a date/time, number, currency, or percent. For each choice, an options tab will appear offering specific formatting options, such as decimal places, currency signs, etc. The options are self-explanatory. Enable Cell Style: check this box to enable conditional formatting for this cell (i.e., within when the table grid appears in the end users browser, a value in this column that meets certain conditions may optionally use a different style than other columns, or even values in the same column above or below it. In this way you may highlight a particular value with a red background, make the value bold, etc. Note that you must have previously defined more than one Data Row Style in the Style Sheet Editor to display a contrast between this cell and others. You may make the visual differences as subtle or as overt as you wish. Default Cell Style: select one of the Data Row Style Options you previously defined in the Style Sheet as the default row formatting. The options appear in a drop down list. Use Additional Cell Style: select Conditional. No indicates that you wish to use a single style. Conditional selects one or the other style dependent upon a field value, chosen below. Additional Row Style: select the other style. This will format the cells that meet the condition. Column to Test: when specifying a conditional option, select one of the fields in the browse to test, by choosing from the drop down list. Operator: choose an operator for the test from less than or equal to, equal to, not equal to, or greater than or equal to. Value: enter the value for the comparison.
133
Likewise, the custom column could contain a graphic which might link to a page at the site which was not generated by Clarion/PHP. For example, you might use a shopping cart graphic to link to a shopping cart page, and pass a product ID as a parameter. Or, the static column could provide a graphic containing any other type of custom link, such as a link to create a blank email message in the end users email client, filling in the subject line (mailto:[email protected]?subject= some subject). By default, Clarion/PHP automatically populates one custom column, the Automatic Detail Link, when you populate a browse. This places a graphic at the end of the row, which the end user may click on to view an update form (view only by default, or edit, by option) for the selected row. This automatic population may be overridden on the browse procedures overrides tab, and afterwards, the custom column deleted. Use the Insert, Properties, or Delete button to add, edit, or delete static columns from the list box, and edit the columns properties via the Custom Columns properties dialog, detailed below:
134
Column Name: merely provides a convenient way to reference this column. Alignment: right or left align the cell. Location: the static column(s) must always appear either to the left of, or the right of your data columns. Choose one. Create this Column as Link: this group box allows you to specify that when the end user clicks on an item in this column, the browser will open another page. The default choice is No.
To enable the link to open an update procedure (or another procedure, for that matter), check the Procedure Link box and specify the name of the procedure from the dropdown list. Remember to apply the PHP form procedure to the procedure you select.
135
Indicate in the second dropdown box the action to apply to the procedure: whether its to view data only, or to add, edit, or delete a record, or to list data, as in the case of opening up a browse on a child file. Hyperlink: allows you to add an HTML or JavaScript link in the Custom Link edit box below.
Note that the custom link capability is useful for more than just linking to a static HTML page. You may provide, for example, an HTML parameter, such as http://www.mydomain.com/page.htm?parametername=value. Or, you may include field data as a parameter, passing the value of the current row of the current field (in the following example, called ID, such as http://www.mydomain.com/page.htm?parametername= . Request(ID)). Note that the first part of the URL is double quoted. You are responsible for everything including the <A> to the </A> tags for this link. You may concatenate strings and JavaScript functions, and reference session and data variables using JavaScript functions. Its important to note that the text you enter in this box will be temporarily stored in and PHP string variable, and therefore will be surrounded with double quotes. The code surrounding yours will appear with yours as:
mylink = YourText/CodeGoesHere
This means that if you mix string and functions, you must watch your concatenation. If your custom link is (1) string only, just type your string and not worry about the quotes: MyString If your custom link is (2) a string with a function concatenated behind, dont forget to close the opening quote, concatenate your function (using a . character in PHP), and then open the following quote: Mystring . MyFunction(param) . If your custom link is (3) a function with a string concatenated behind, dont forget to close the opening quote, concatenate your function, and then dont close the following quote: . MyFunction(param) . mystring If your custom link is (4) a function only, dont forget to close the opening quote, concatenate your function, and then close the following quote: . MyFunction(param) . If you have several elements, just remember where the quotes will be.
136
CLARION/PHP Users Guide To reference a session variable, use the getSession function (from the generated utils.php). To reference a data element in the current form, use a php code to return it from the recordset: $oRStablename->fields["fieldname"]. You may use text functions to trim and insure against returning a null variable, as in: trim($oRStablename->fields["fieldname"]). Because the custom link options are almost completely free form, they serve as very nearly a way to place embedded PHP code in your applications. Note that the custom link capability is useful for more than just linking to a static HTML page. You may provide, for example, an HTML parameter, such as http://www.mydomain.com/page.htm?ID1=value. Or, you may include field data as a parameter, passing the value of the current row of the current field. The following example shows concatenating strings and PHP code to make a dynamic URL incorporating the data from each cell as a parameter:
<A HREF=UpdateSuppliersView.php?ID1=" . trim($oRSviewContacts->fields["EditSupplier"]) . "> <IMG alt='Supplier Details' src='/images/supplierdetail32x32.GIF' border=0> </A>
Image Button: press to provide details for displaying an image in this cell, when selecting either a procedure or custom link.
If youve chosen to display an image in this column, you must fill out Image dialog after pressing the button: Populate From: specify whether the image resides as an external file or a binary column in the database. Note that Clarion/PHP has tested binary images stored in the MS SQL Server database. File Name: if the Populate From option points to an external file, specify the file name. An example use of a static image might be a small pencil image, symbolizing a link to an update form. Remember that the file name must be either relative to the applications web directory, or to the web root directory. ID Value Column: if the Populate From option points to an image stored in the database, specify the unique ID column for the row. Table With Image: if the Populate From option points to an image stored in the database, specify the column containing the image. Making this a separate option, allows the DBA to store the images in a table separate from the table used for the browse. ID Column: if the Populate From option points to an image stored in a separate table in the database, specify the unique ID column for that table. Image Column: if the Populate From option points to an image stored in the database, specify the column containing the binary image data.
CLARION/PHP Users Guide Image Type: if the Populate From option points to an image stored in the database, specify jpg, gif or png.
137
An additional tab, called Column Header allows you to place a column text label at the top of the column in which the images will appear. Column Header Text: the text which should appear at the top of this column.
138
139
This allows you to override the following for this procedure: Style Sheet HTML Template Generation of Help and/or HTML Files Show Help Link Show Navigation Buttons Titles and messages Associated With This Form (for example, instead of Your Insert Failed, a message such as Due to a database error your order was not posted. If the error continues please contact the administrator might be more helpful to your users. Includes
Please see the Global Options section for specific explanations of these options, except Includes, which are explained in detail in chapter 9.
140
CLARION/PHP Users Guide Note that the checkbox for security is only available if youve turned security on at the global level. The Enable security for this procedure checkbox option allows you to turn security off for this procedure. Note that the checkbox is only available if youve turned security on at the global level. Additionally, by overriding the global security option you may add My Records functionality, as explained below.
My Records
The Clarion/PHP My Records support allows you to specify ownership of records by user. Each user then views and edits only those records for which they have ownership. The general process is as follows: At login the end user uniquely identifies themselves. This is stored in a session variable (usually, UserEmail is used, because many sites have adopted the email address as a common identifier; its unique to each person and easy to remember). When the user adds a record to a My Records update procedure, one of the table columns receives the session variable (email); this is done without showing the field on the form. In a browse procedure, a filter is placed on all records limiting the rows viewed to those with the email (or other session variable) in that particular column. Similarly, delete, search and view form procedures limit their scope to the users records.
To enable all this functionality, first turn security on globally. You must enable My Records support on a procedure-by-procedure basis (both browses and forms). To enable My Records on a form, check the Override box on the Globals tab, then fill in the Security sub tab, as described in the following section.
141
Select the data column that is to store the user information to test against. This column should be present in the form procedures primary table. When you design the database, be sure to provide that your master security table and any tables you wish to provide My Records support for all include a field of the same data type and length, which you will use for these purposes. You may name the columns whatever you wish; you need not specify the same name for the column in every table for which it appears. Select the session variable to test against it.
4.
In many cases, web sites use an email address as a unique identifier. Clarion/PHPs global level security dialog. Therefore in many cases, youll simply pick the UserEmail session variable. You may use the My Records variable to limit record access not only by user, but by type of user, as in the following examples: The Northwind sample databases employee table contains a reports to column. You may filter a form so that managers may edit only their direct reports by specifying the reports to column as the data column to compare, and using the employee table as the security table, the employee ID as the user ID, and then using the UserID session variable to test against the reports to column. By not enabling My Records on the browse, the managers can see a listing of all employees, but then can only link to an edit form for their own employees. Similarly, you may declare an additional session variable, such as Department, editing the login.php page to assign the session variable based upon department data which you would store in the security table, and then choose that session variable to compare to a department value in your primary form table. You could similarly substitute region, sales territory, etc.
Once youve correctly set up the My Records options for each procedure, you need do no more; Clarion/PHP automatically hides the necessary fields, applies the necessary query filters, and takes care of setting the data defaults for new records. Note that should you be applying the functionality to existing data and are adding a column to a table that you must add the values necessary for the existing records, else they will not appear within any users My Records filter.
Security Levels
You may set separate security levels to permit adds, changes, deletes and viewing the form. Specifying a level requires a number between 1 and 99 which will then be checked against the user database (see Global Options). if the user meets or exceeds the requirement, the page is then accessible. If not, a message is displayed, which is configurable by the developer in the global settings.
142
Titles (Insert/Edit/Delete/View/Search)
These boxes allow you to specify the name of the page for each of the actions. The page title appears in the caption bar of the end users browser.
Messages
These boxes allow you to override the default status messages which display following the completion of the update procedure.
Navigation
These boxes allow you to override the navigation button tool tips as well as providing a custom first or last record reached message.
Form Options/ActionsTab
The Actions tab allows you to set the update functionality, and whether following an update the end user should see a status page or a custom page.
143
Allow (Insert/Edit/Delete/View)
Check the boxes for the actions you wish to enable. Note that View provides for a read only form.
Page to Return To
Normally after an update, change or delete, the end user views a status page stating that the update succeeded or failed, as below:
If instead you prefer that the end user is sent to a page of your choice, type a URL in the box(es) marked Page to return to next to the action you wish to tie the page to. This provides, for example, a convenient way to provide for repeat adds, via which the end user is presented with a new blank add form following a successful insert. Or it may simply return the end user to a table of contents page. The return mechanism provides additional functionality in that you may add a template symbol to your own HTML or PHP page, if youve defined it as the target, and Clarion/PHP, following the insert, will merge the values of any known symbols into that page, using a mechanism similar to the HTML runtime template technology. If you do not insert any symbols, there will be no effect on the page the end user sees. The return mechanism thus provides for the following additional functionality: Display Security Variables or User Defined Variables in the Target Page: by default, if security is active, the symbols available for insert are the security session variables (@UserID@, @UserEmail@, and @UserName@). You may insert any of these into the target HTML page and the merge routine will substitute the values. Additionally, any user defined variables which you defined at the global level, and which you stored values in (at previously executed embed points) are available. Return to Calling Browse or Query Form: you may also use the return mechanism to deliver the end user back to a browse or query form after a successful insert. Note that should you wish to return the end user to a browse which had previously been filtered, you must add a URL parameter: ?SUBSET=TRUE.
144
CLARION/PHP Users Guide Repeat Add Mode With Prefilled Fields: in some cases the developer may wish to set certain fields on the add form to repeat the previous value, so that the end user, in effects, fills in half the form, and each subsequent add only requires that they fill in the other half. This requires embed code in the add form. The general process for executing this would be: (1) declare user defined variables for each of the repeated fields at the global variable, (2) examine the PHP source for the Add page and identify the variable name used in the PHP code (normally TableNameFieldName, found on a line such as):
Then, (3) in an embed point such as prior to closing the record set, assign the value of that variable to your user defined variable such as:
SESSION(myUserDefinedVariable) = CustomersCompanyName
Finally, (4) at an embed point after opening the record set, assign the opposite of the above. Note: Repeat Add Mode does not depend on the return mechanism; following these guidelines this same functionality works for any add linked to from any page (not necessarily a previous add), automatically retrieving the values previously stored in user defined variables for that session. The return mechanism merely provides a convenient entry point in that in many cases the developer wishes the Repeat Add Mode functionality for a series of rapid fire adds.
145
next update form in a repeat add), you must use one of the Processor embeds (see chapter 8) to store the message in a user defined variable (at the last embed point in the Processor, simply assign ud_YourVariable = mystatus). Whether or not you display the message in your page, by entering a page of your own in the target action, as described above, after the update operation the Processor page will open that file, search for any user defined @symbols@ (as listed in the user variables tab of the global extension), merge/replace those symbols with the corresponding variables, and then output your page to the end user. This provides you with a flexible means of routing and informing the end user through each update or insert operation.
Generate QBF
If checked, specifies the generation of an additional page containing a Query by Form. Upon user entry, the form will automatically run the query and display the results in a parent browse.
Parent Browse
Specify the name of the browse procedure that will link to the form, as well as the browse that will appear subsequent to the Query by Form (if the previous box checked.
Form Options/Help
The Page tab allows you to set the help links for the page.
146
Connections
This tab allows you to select the connection object you want to use for a specific action
Table Tab
The form template is designed to retrieve and update a single table at a time. You may not include fields from other tables (even as display only fields) on your form, except (1) by populating the file drop control template in the window formatter, or (2) by editing the .php file post generation, modifying the FROM clause. Note that the latter process is demonstrated in the Annotated Examples book. Form Primary Table: the table to be updated. Choose a table from the dictionary, using the ellipsis button to select from a list. Unique Key: a unique key which identifies the row.
SQL Tab
Regenerate SQL: should you change the form controls (using the WINDOW structure), you may press this button to immediately update the SQL select statements, else the SQL will regenerate only after you close and then reopen the procedure properties.
147
Because you may manage both PHP and ASP applications with the same extension, and because the PHP statement to retrieve the URL parameter identifying the unique ID will be different for the two platforms, you may manually edit the SQL/PHP statements separately. Choose one tab or the other. Additionally, should you wish to edit the statements manually, check the Freeze SQL Statements box, so that opening the procedure after editing the window or pressing the Regenerate SQL button does not override your manual changes.
148
CLARION/PHP Users Guide important to review the properties for each control. Example: formatting pictures do not come from the dictionary; instead, they come from ADO. The MS SQL Server Northwind sample database, as an example, includes a price field in the Products table. This data type is money. Therefore, a Clarion/PHP application will correctly display a currency symbol for this value, using the local currency symbol as set on the SQL Server. This particular field is also defined in the database as having a precision of four. Therefore, the PHP page correctly displays the value with four decimal places. To review the control properties, select a control from the list and press the Properties button. This presents the Controls dialog, which contains the following sub tabs and options:
149
Populate: enable or suppress (dont generate) the control on the generated PHP page. HTML Form Element: the control type. Choose from Input (entry box), Check (Checkbox), Radio, Select (List box), and Text area (multi line text box). Note that the control type choice will affect the options in subsequent tabs. Bear in mind that these are the native HTML control types, and the names used are those used when populating an HTML form. Caption: the equivalent of the prompt text for the control. Note that mnemonics and accelerator keys are not possible. Tool Tip: the tool tip will be inserted as an ALT tag for the control. Internet Explorer and the latest version of Netscape utilize this text as a tool tip. Note that older versions of Netscape do not. Formatting Function: optionally select DateTime, Number, Currency or Percent to specify formatting. Each choice provides additional appropriate options such as the number of decimal places for number formatting, or short/long date format. The pictures apply to both display and input; therefore it is vitally important that on input, the end user must be educated on what the acceptable input is. If, for example, a picture provides for two decimal places, but the end user types in three, or if a long date is provided for but the end user types in a short date, the server will return an ADO error. Case: optionally specify case conversion to normal, lower case, or upper case. Password: optionally specify password field entry. Read Only: check this box to disallow editing of the selected column. Omit From QBF Page: this deletes the field from the Query by Form page. There are excellent reasons for omitting fields from the Query by Form. Firstly, the less fields, the simpler; chances are 80% of the queries will only require 20% of the fields or less. Secondly, querying a non-indexed field may require greater effort on the part of the DBMS.
Note: remember when populating a checkbox control on a query form that unchecked does not mean null (or no choice for that field). It means the query seeks records for which the value for that field is false. This concept could be confusing for many end users; therefore we recommend that when using Queries as a main navigation aid for your applications that you review the use of checkboxes.
150
CLARION/PHP Users Guide Maximum Characters: allows you to size the controls (width only). Rows and Columns: for text area controls, this allows you to specify the width in characters and the height of the control in lines. Note that the typeface in all text area controls in monospaced (the text looks like typewriter text). This is a limitation of HTML, and there is no method of changing this.
Note that My Records filter fields will appear in the controls list as normal; however, they will be hidden from the end user in the update form.
No Validation: self-explanatory. Cannot be Null: self explanatory. Be sure to fill in the Validation Alert Text Message. Must be in Numeric Range: self-explanatory. Fill in at least one of the Numeric Range options, and the Alert text. For the numeric ranges, check either lowest, highest, or both, and fill in numeric values. If lowest is checked, than the validation is greater than the value; highest, lesser than, and both, the value must be in between low and high. Must Be In List: this works in conjunction with the List options set in the dictionary. You may not edit the list values here; they are provided only for display. Should you wish to change the options you must change the dictionary.
151
Alert Text Message: this provides you with the ability to type in a string, which will be presented to the end user in a message (or popup) box. Must Be In File: allows you to specify a primary/foreign key relation as set in the Clarion dictionary. You must additionally choose a select browse from the dropdown list. This behavior (on an entry field or HTML input) mimics the Clarion Lookup behavior. It automatically populates a select button next to the entry field. The end user may then press the button, choose from the select browse popup, and the entry box then receives the proper value according to whichever row in the select browse the end user chooses.
You must manually choose the proper select browse for all the Must be in File columns which appear in the update form; the procedures dropdown list will default to the first browse in the application tree. If you forget to make a choice, it is likely that the lookup button will display an entirely different browse in the popup, one which may not even contain clickable fields from which to choose a value. You must also apply the browse extension template to the Select Browse procedure in order for Clarion/PHP to generate an PHP page for the select browse. You may specify a range limit for the select browse, utilizing the current value of any of the entry fields in the current update form, matching it to a column in the select browse. As an example, if the select is to choose a product ID, and the end user has already specified a category ID, the select browse can range limit to that category ID. Press the Insert button in the Lookup from File tab to choose the source and target columns. The Value to Pass dialog allows you to select a source column. This will call the select browse with a WHERE limiting the browse to only those rows that match the current value of that field on the update form. You must also specify the target column of the select browse whose value should match this column. You may have to insert the related table into the field chooser dialog.
152
153
The Combo Options Sub Tab offers these options: Unique ID Column: the column in the related table providing the unique value by which to identify a choice selected from it. Value Column: the column in the related table providing the value for the target column in the forms primary table. Display Column: the column in the related table from which you which to display data for the user to select. Target Column: the column in the forms primary file into which you wish to save the value selected by the user from the related table. Lookup SQL: if youve placed the template as above, youll see the SQL statement to retrieve the values from the related table. In some cases it may be necessary to edit this statement.
154
CLARION/PHP Users Guide Populate: this checkbox indicates that you wish to generate code for this custom control. Control Name: merely provides a convenient way to reference this column. Caption: provides for a label which appears to the left of the field. Control Location: specify that it appear either at the top of the form or at the bottom of the form. Populate From: specify static text (including null) or a session variable. Enter Display Text: enter the text the end user should see, or a null string (leave it empty) should you wish to display a graphic.
On the Actions tab: Create this as a Link: specify the link type (procedure or custom) or not as a link. In general, not creating a link is simply a means to populate a picture on the form that doesnt do anything. To populate a picture that leads the user to another page, specify a procedure or custom link. Pass this Data: allows you to pass the value of this control to a procedure. Data Column to Pass: allows you to define which column from the form contains the data to pass. Session Variable to Pass: allows you to define a session variable to pass to a procedure. Static Entry: allows you to pass a string to a procedure. Additional Parameters: allows you to pass additional parameters when specifying a procedure link with static entry. Fill in in the format parametername=value, or parametername1=value1¶metername2=value2. Procedure Link: to enable the link to open an update procedure (or another procedure, for that matter), check the Procedure Link box and specify the name of the procedure from the dropdown list. Remember to apply the PHP form procedure to the procedure you select. Indicate in the second dropdown box the action to apply to the procedure: whether its to view data only, or to add, edit, or delete a record, or to list data, as in the case of opening up a browse on a child file. Type of Procedure: specify the type of Clarion/PHP the target procedure is (list, add, edit, or delete).
155
Custom Link: allows you to add an HTML or JavaScript link in the Custom Link edit box below. You have complete control of the link, which means that you may specify custom tags such as Flash files.
You are responsible for everything starting with <A> to the </A> tags for this link. You may concatenate strings and Java functions, and reference session and data variables using JavaScript functions. Its important to note that the text you enter in this box will be temporarily stored in and PHP string variable, and therefore will be surrounded with double quotes. The code surrounding yours will appear with yours as:
mylink = YourText/CodeGoesHere
This means that if you mix string and functions, you must watch your concatenation. If your custom link is (1) string only, just type your string and not worry about the quotes: MyString If your custom link is (2) a string with a function concatenated behind, dont forget to close the opening quote, concatenate your function, and then open the following quote: Mystring . MyFunction(param) . If your custom link is (3) a function with a string concatenated behind, dont forget to close the opening quote, concatenate your function, and then dont close the following quote: . MyFunction(param) . mystring If your custom link is (4) a function only, dont forget to close the opening quote, concatenate your function, and then close the following quote: . MyFunction(param) . If you have several elements, just remember where the quotes will be. To reference a session variable, refer to ti as $SESSION(variablename). To reference a data element in the current form, use an ADODB function to return it from the recordset: oRStablename(fieldname). You may use text functions to trim the string, as in: trim(oRStablename("fieldname")).
<a href='BrowseProductsList.php?WHR=dbo.Suppliers.SupplierID1=" . trim(oRSSuppliers("SupplierID"),1,50) . "'><img src='/IMAGES/products.GIF' width='32' height='32 alt='Products' border='0'></a>
156
CLARION/PHP Users Guide Because the custom link options are almost completely free form, they serve as a close facsimile to placing embedded JavaScript in your applications. Image Button: press to provide details for displaying an image in this cell.
If youve chosen to display an image in this column, you must fill out Image dialog after pressing the button: Populate From: specify whether the image resides as an external file or a binary column in the database. Note that Clarion/PHP has tested binary images stored in the MS SQL Server database. File Name: if the Populate From option points to an external file, specify the file name. An example use of a static image might be a small pencil image, symbolizing a link to an update form. Remember that the file name must be either relative to the applications web directory, or to the web root directory. ID Value Column: if the Populate From option points to an image stored in the database, specify the unique ID column for the row. Table With Image: if the Populate From option points to an image stored in the database, specify the column containing the image. Making this a separate option, allows the DBA to store the images in a table separate from the table used for the browse. ID Column: if the Populate From option points to an image stored in a separate table in the database, specify the unique ID column for that table. Image Column: if the Populate From option points to an image stored in the database, specify the column containing the binary image data. Image Type: if the Populate From option points to an image stored in the database, specify jpg, gif or png.
157
In the code above, we first check that theres not a variable already declared (since this is called by every page), and if not, then we declare it. As another example, the developer may declare a user defined template symbol called ud_MyVariable. The developer might then insert a column into the runtime template for a browse, and place the corresponding symbol there. The symbol should be the variable name preceded and suceeded by an @ sign, as in @ud_MyVariable@. Continuing the example, within the embed tree the developer locates the node labeled After start build (html) rows. The end user inserts code that calculates whatever the value should be for ud_MyVariable, and assigns it. (Remember that the PHP code written by the developer has access to the values in the current record; thus, a running total, for example, can be coded. The developer should also recall that they should destroy any objects they create. Session objects may also be created and used).
158
CLARION/PHP Users Guide At run time, that code executes, it gets merged, the value appears alongside the other values in that row, and in all the other rows of the browse, according to what the proper value should be. Other embed points are available; the embed point within a browse row was just an example. The templates exercise no limits on the PHP code you insert. You may, for example, reuse a connection object, create a new SQL statement and recordset object, and add, say, a count and grand total of all orders for a customer by opening a details table and using an aggregate query, even though the PHP page generated by the template never opens that particular table.
Assuming the developer wishes to display the results of their code within a page, the developer or web designer edits the desired runtime template and inserts the @variable@, i.e., the variable name surrounded by the @ sign at the appropriate place in the page.
159
Connection Object
After Opening the Connection Object Before Closing the Connection Object
Recordset Object
After Opening the Recordset Object After Starting to Build the Data Rows (this refers to the loop for each record within the browse table, during which Clarion/PHP gets the contents of each field, formats it, and stores it in the symbol for output. Use this embed point when using a variable that should display a different value for each row of the browse table. This allows you to execute your code before the first column value is assigned; the record set is already open at this point). Before Ending the Building of Data Rows (same as above, except after all the column values have been assigned).
CLARION/PHP Users Guide The embed opportunities in the form procedures can be organized as follows:
161
Connection Object
This allows the developer to insert code before and after connecting to the database, allowing, for example, modifying the connection string. After Opening the Connection Object Before Closing the Connection Object Before Executing the Delete (Delete mode only)
Recordset Object
This allows the developer to insert code before and after accesses to the record set, allowing, for example, calculation of values for hidden fields, such as extended totals, before saving. After Opening the Recordset Object Before Closing the Recordset Object Before the Update (Add and Edit modes only) After MoveFirst (this executes after opening the recordset and moving the cursor to the first record; Edit and View modes only).
Merge Call
The merge call refers to the point at which the PHP code replaces the symbols in the runtime HTML template with data values from the row. This allows, for example, the ability to calculate a user defined variable which is to display in the page. Before the Merge Call After the Merge Call
162
163
Examples
Form Embed
The example below modifies the customer view only update form from the Orders example (see the Annotated Example book). The custom code uses the current connection, declares a new recordset, defines the SQL select using the current customer value, opens the Orders table (which otherwise would not have been open), retrieves the orders for that customer, sorts them by date descending, gets the first (most recent) date, assigns it to the user defined variable, then closes the record set. In the runtime template, a symbol corresponding to the variable is placed at the bottom of the form, and at runtime, the most recent order for that customer appears. In effect, your custom code therefore performs a related task to that performed by the Clarion/PHP procedure. It could just as easily have called a stored procedure, done some other maintenance, etc.
164
CLARION/PHP Users Guide Weve commented the embed code (note that should you wish to cut and paste it into the embed point you must clean up any word wrapping!):
// Display the last purchase date // First, declare and init the variable for the SQL statement $ud_MySQL = "SELECT dbo.Orders.OrderDate FROM dbo.Orders WHERE dbo.Orders.CustomerID = '" . $oRSCustomers->Fields("CustomerID") . "' ORDER BY dbo.Orders.OrderDate DESC"; // Declare a recordset variable and create it by using the Connection object Execute method and the SQL statement $ud_rsTemp = &$objConn1->Execute($ud_MySQL); // Check if there are recors $ud_OrderCount = $ud_rsTemp->RecordCount(); // if so... if ($ud_OrderCount > 0): // Move to the first record $ud_rsTemp->MoveFirst(); // and assign the ud_lastpurchase variable $ud_lastpurchase = $ud_rsTemp->Fields("OrderDate"); else: // else, clear the variable $ud_lastpurchase = ""; endif; // Close the recordset $ud_rsTemp->Close(); // and dispose it unset($ud_rsTemp);
Save the embed. Within the extension properties for the procedure, check the Do Not Generate HTML on the overrides tab (you must now edit the runtime template, and you dont wish to overwrite the changes at the next regeneration). Save the .app and generate the PHP source. Open html\UpdateCustomersview.htm in your HTML editor. Add a symbol (perhaps at the bottom of the current form) for @ud_lastpurchase@. Note that the PHP merge routine is case sensitive, so it must match your declaration. If you wish it to match the rest of the fields on the view form, be sure that to use the input class. Add a prompt, such as Last Purchase to the runtime template, and optionally use the label class for the prompt.
CLARION/PHP Users Guide Deploy and test. The end result should look something like this:
165
166
167
Browse Embed
The example below provides a line item total for the Order_Details table of the MS SQL Server Northwind sample database. The fields used in the example are Quantity, UnitPrice and Discount (Quantity times UnitPrice, minus Discount, equal the LineItemTotal). Should you wish to create an equivalent example, wizard an application on this table, set the Order_ID field as the range select (be sure that your URL includes a valid ?ID1 parameter, such as ?ID1=10248), apply the global and browse template, and then follow these steps:
Weve commented the embed code (note that should you wish to cut and paste it into the embed point you must clean up any word wrapping!):
// First check that Quantity isn't 0 if ($oRSOrder_Details->Fields("Quantity") > 0): // Now you can get the recordset variables and calculate $ud_LineItemTotal = ($oRSOrder_Details->Fields("Quantity") * $oRSOrder_Details->Fields("UnitPrice")) - $oRSOrder_Details>Fields("Discount"); else: // otherwise, clear the variable $ud_LineItemTotal = ""; endif;
168
Type the following code. All this line does is clear the variable after weve merged it into the form:
$ud_LineItemTotal = "";
The simple browse below contains no customizations, data formatting nor style sheet customizations, but merely demonstrates the code. Note that the HTML runtime template was edited with an HTML editor, a column inserted at the end with no style tag, and the symbol @ud_LineItemTotal@ placed in the cell in that column.
169
Ch. 9:
HTML Includes
Clarion/PHP includes the ability to specify include files which will be incorporated into the runtime HTML template, at the time the data is merged into the page. This provides for server side include functionality. The include file may contain either HTML or JavaScript (for client side execution). Though not limited to only these three, the general areas of functionality that these include points may provide for are: JavaScript function libraries for client side execution. Standard boiler plate HTML sections such as company contact information or even banner ads, which allow for a single update throughout a site whenever something changes. An almost componentalized approach to the HTML layouts for your application. Through use of the HTML includes you can include different sections above and below the Clarion/PHP elements on a procedure by procedure basis, allowing you to provide related functionality to any procedure, based on the procedure.
170
CLARION/PHP Users Guide Finding the correct places in your design time template to insert the comments should be a simple matter; just locate the proper tags (<html>, <head>, <title>, <body>) which will no doubt be located in your design time template.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <!--@HTML_AFTER_OPEN@--> <head> <!--@HEAD_AFTER_OPEN@--> <title></title> <!--@HEAD_BEFORE_CLOSE@--> </head> <body> <!--@BODY_AFTER_OPEN@--> <!--@BG_BEFORE_OPEN@--> @Clarion/PHP@ <!--@BG_AFTER_CLOSE@--> <!--@BODY_BEFORE_CLOSE@--> </body> <!--@HTML_BEFORE_CLOSE@--> </html>
171
: A note on the <bg> tags: the after open and before close <bg> tags in the template interface refer to tags which will be inserted at the time the runtime templates are generated (when you run the Generate All command in the development environment), and are not present in the design time template. This allows you to provide for an include inside the portion of the page which will include the Clarion/PHP components. The template interface includes a tab on the Global extension called Includes. It provides edit boxes corresponding to all the insertion points above. Type in a file name in a box or boxes. Remember that the path must be a relative reference to the location of your .php page within your web. (For example, should you place a file called myinclude.htm in the project/php/html directory, then the box should read html/myinclude.htm.
172
CLARION/PHP Users Guide At the time that the end user requests the PHP page that corresponds to the HTML runtime template page, the script in the PHP page will be executed, the merge function will read the runtime template and any included files, placing the content of the included files into the spot chosen, and then turn the combined document over to Apache to output the page.
Should you wish to merely experiment, feel free to include the procs.htm file which will be automatically generated by Clarion/PHP, and youll see a table of contents below your Clarion/PHP elements. For java script function libraries, simply make sure that the <script> tags are present in the include file, and place the include at the @HEAD_AFTER_OPEN@ include. Note that should you wish to include more than one file in one include point, youll create an include file that merely includes the other include files, and that will be the file you place in the template interface. For non printing HTML items such as meta tags, it may very well be the case that you wish to define these on a procedure by procedure basis rather than on a global basis (which might normally be done in the design time template). Remember that you may override the includes on a procedure-by-procedure basis, allowing you to create an include file only with the meta tags that you wish for a specific procedure. By using the includes, the developer need not edit the individual runtime HTML template for the procedure (saving the necessity of editing four templates for an update procedure). The keyword usage of the meta tag might typically be something like the following, and should be placed within the <head> tags:
<META NAME =keywords CONTENT=lions, tigers, bears>
It may also be the case that you wish to set cookies on a procedure by procedure basis, which can also be done with an include, such as:
<META HTTP-EQUIV=Set-Cookie CONTENT=cookievalue=xxx;expires=Tuesday, 31-Dec-02 16:14:21 GMT; path=/>
173
Final Notes
The procedure overrides provide exactly the same insertions as the global; the only difference is that the explanatory text does not appear above the edit boxes. Remember to check the override box to enable access to the sub tab.
174
175
Application
To create a PHP source code procedure, add a procedure to the Application Tree by selecting an existing procedure, then choosing Procedure > New from the development environment menu. Name the procedure and choose Source as the type of procedure. Once the Procedure Properties dialog opens, press the Extensions button, and apply the PHPSource extension. (Note: you can apply the extension to existing procedures; we simply suggest a new procedure for organizational purposes, and to make it easier to remember where you placed the code.) Once the extension is applied, you will see a new embed node called Clarion/PHP for the procedure, and you may use the Embeditor to write the PHP code.
176
At the time you apply the extension, you will also note a page to return to box. This will be the page that the end user is redirected to after the source code procedure page executes. This can be overwritten via a page parameter (?toURL). At generation time, the page generated will be named in the format ProcedureNameSource.php. Note that a default security level of 1 is applied to the page, should security be applied to the application. To change the security level, edit the generated code.
177
Usage
The normal means of routing the end user to the source code page is either linking to it as a normal HTML link from within the referring page, or setting the source code page as the page to return to for the Actions of an Insert, Edit, or Delete page. The latter method is more appropriate, since this is designed as something to execute between actions. Assume a case in which a session variable is used to keep a running total of daily sales by a particular representative for that session. It would be a simple matter to insert embed code to display a user variable at the top of every page, and query the database each time a new page displayed; but theres no necessity to tax the DBMS with a query which returns the same result every time except if an insert, edit, or delete was made (this assumes no other operator may change the representatives records). In this case, the query could be stored as a source procedure, the result stored in the session variable, and the source procedure could be called only after an edit change or delete. The procedure to accomplish this would require the following steps: Declare a the user defined variable for the running total, such as ud_MyRunningTotal. When added in the global extension, Clarion/PHP automatically creates the session variable. Insert the @ud_MyRunningTotal@ symbol in the design time template, assuming that the intention is to display the running total on every single procedure. (for example, in this case the designer might create a box in a top corner of the page in a bright color, and in the box, display the running total). Create a source code procedure (named, for example, DisplayMyRunningTotal). Set the to URL to whatever page is desired to be viewed after an operation, for example, MyStartPage.php. Apply the PHP Source Code extension to the procedure.
178
CLARION/PHP Users Guide Add embed code to the procedure declaring a connection object, running the query, and storing the return value in the session variable (note: we apologize for any word wrap problems):
// //Declare connection object, recordset, and query string $objConn1 = &ADONewConnection(mssql); $objConn1->PConnect(YourServer, UserID, Password, northwind); // Set the SQL statement $ud_mySQL = SELECT SUM(ExtendedTotal) AS RunningTotal FROM dbo.ORDERS WHERE dbo.ORDERS.RepID=123; // // Open the recordset using the connection object // and move to the first (and only) record $ud_oRSRecordset = &$objConn1->Execute($ud_mySQL); $ud_oRSRecordSet->MoveFirst(); // // Use the format currency function with 2 decimals // and store it in the session variable $ud_MyRunningTotal = formatCurrency($ud_oRSecordSet>Fields(RunningTotal)); // // Clean up! $ud_oRSRecordSet->Close(); unset($ud_oRSRecordset); $objConn1->Close(); unset($objConn1);
Save the embed, and then open the update procedure for Orders. On the Actions tab, set the Page to return to for insert, update, and delete to (in this case) DisplayMyRunningTotalSource.php. Generate and test.
179
To begin the process of editing your style sheet, open the PHP global extension template, and on the global tab press the Style Sheet Editor button.
180
If editing an existing style sheet, select it and press Properties. To create a new style sheet, press the Insert Button. To delete an existing style sheet, select it and press Delete. After choosing Insert or Properties, you may now format the individual elements in the Style Sheet dialog. There is one important thing to remember when choosing colors, through this dialog. Because were using the default color pickers within the Clarion template interface, at the top of the color picker dialog youll see the choice for Windows component colors (such as the window background, button highlights, etc). As you know these are valid choices for a Windows program, but invalid for an HTML application, unless using Cascading Style Sheet specification 2.0, which means that older browsers will not be able to resolve that color choice. Be sure to choose either a color box or a custom color. The template system will resolve your choice to a hexadecimal value (red/green/blue).
181
File Name: type in a valid file name. It will automatically receive a .CSS extension. Hyperlinks: youve probably observed that the default hyperlink colors for most browsers are blue for unvisited, red for visited, and that the link appears underlined. Other than that, a plain text link simply appears as plain text.
There are four possible states of a hyperlink which you may format individually. For each state a button appears, and you may choose the exact formatting in the subsequent dialog. The states are: Normal: The hyperlink is unvisited, does not have the keyboard focus, and the mouse is not over it. Active: The hyperlink had keyboard focus. The normal browser behavior is to display a dotted rectangle around it. Hover: The mouse has paused over the hyperlink. Visited:The page pointed to by the hyperlink has been visited previously.
To format each of the options, press the appropriate button (labelled for each). The dialog which appears contains a check box which specifies that you wish to override the default browser settings (to undo your customizations at any time, simply uncheck the box).
182
The formatting options for each of the above categories are as follows: Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h. Text Decoration: this provides simple text effects, i.e., underline, over-line (line above), line through (crossed out) and blinking text.
Text Transformation: this provides simple character formatting options, i.e., capitalize, upper case, lower case, none, and inherit (from whatever tag this tag is embedded in, i.e., from any page, table, etc. in the default template). Font Style: normal or italic. Note that bold is provided for via Font weight. Font Weight: note that this setting is comparative to the default browser font settings. Choose from normal, lighter, bold, or bolder.
183
Font Size: note that this setting is comparative to the default browser font settings. Choose from larger or smaller, or from extra-small to double-extra-large.
This tab presents the following options: Width: specify a value either in pixels (the number you wish, followed by px without the quotes, or, as a percent. To specify that the body should fill the maximum width of the browser window (or of the frame, should you place the generated PHP page inside a frame), enter 100%. Background Color: choose a color from the color picker. Remember that your browses and forms will be placed on top of the background; therefore dont select clashing colors. Note: to choose no color, delete any value in this box, or type COLOR:NONE. Text Alignment: choose left, right or center.
Whenever you choose a font for web content, the formatting options must be limited to what the majority of browsers will support. A web developer cant simply choose a font from their machine and specify it for a page element. The end user may not have the same font. You should not even presume that fonts that are standard with Windows, such as Arial or Times New Roman will exist on the browser, because the browser may not be on the Windows platform. Therefore, generic font lists can be specified, such as serif or sans serif. Serifs are the small hooks and curls at the ends of individual letters in some fonts. They make fonts more readable, the theory being that the hooks and curves help the eye move from letter to letter in a quicker motion. In the print world, traditionally, large portions of text, such as articles usually are printed in a serif font, such as Times, which is what this paragraph uses. Small bits of text such as headlines, which stand out best for being cleaner, without the hooks, are usually composed in a sans-serif font such as Helvetica, which is used in the section headlines in this document. Note: sans is French for without. For web development, what has generally transpired is that you provide a list of fonts separated by quotes. For example: Times New Roman, Times, Sans-Serif. The browser checks to see if Times New Roman is present on the system. If not, then it checks for Times. If there is still no match, then it checks the browser preferences for the default serif font, of which there will certainly be one. You can specify anything in such a font list, but in the real world, given the penetration of the Windows platform, most font lists have settled on a few Windows names such as Arial and Times New Roman. Clarion/PHP adds Tahoma and Verdana to these. Tahoma comes with Microsoft Office, and so is present on many machines. Verdana was specially designed as a screen font (i.e., it looks good at low resolutions), and is distributed with Internet Explorer, and thus present on even more machines than Tahoma.
CLARION/PHP Users Guide The following options are present in the Font dialog:
185
Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h. Style: choose normal or italic. Weight: choose lighter, bold or bolder. Size: choose smaller or larger, or between extra-small to double-extra-large. Family: as described above. The choice lists are: Verdana, Arial, Helvetica, Sans Serif, Tahoma, Arial, Helvetica, Sans Serif, Arial, Helvetica, Sans Serif Times New Roman, Times, Serif, Courier New, Courier, monospace, serif, sans-serif, cursive, or monospace. You will see the Font dialog at many points within the style sheet editor. Margins Button: The margins button sets up the spacing on the side of the text, top of page, bottom of page, and left/right sides of the page.
You may choose a value from zero to ten in pixels for each side.
186
This tab presents the following options: Width: specify a value either in pixels (the number you wish, followed by px without the quotes, or, as a percent for the data background area. Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h.
187
Data Tab
All your data is presented as a table within a table. The Background Class, described previously, governs the outside table. Placing tables within tables is a solution to the limited page layout possibilities of HTML. Therefore the Data tab is particularly important in that it provides the most immediate place setting for your data. Within this tab are buttons that format all the data elements: header (a header for the entire table), column headers, data rows, footer area (for navigation) input labels (prompts), and inputs (the entry boxes and data controls themselves). Each of the buttons leads to additional options appropriate to formatting each of the elements in turn. Width: specify a value either in pixels (the number you wish, followed by px without the quotes, or, as a percent for the actual data area of the HTML table. Color: choose a color from the color picker. Remember that your browses and forms will be placed on top of colors selected previously for other elements; therefore dont select clashing colors. Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h.
188
Width: specify thin, medium, thick, or zero to ten pixels. Style: specify dotted, dashed, solid, double, groove, ridged, inset, outset or none. Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this would be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
189
190
You may set the following options: Background Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h. Text Alignment: choose from left, right, or center. Font (button): choose the color, style, weight, size and family from the dialog. This dialog is identical to other font dialogs throughout the style sheet editor. Padding (button): set the inside padding for left, right, top and center in pixels from zero to ten. This dialog is identical to other padding choices dialogs throughout the style sheet editor.
191
You may set the following options: Background Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h. Text Alignment: choose from left, right, or center. Font (button): choose the color, style, weight, size and family from the dialog. This dialog is identical to other font dialogs throughout the style sheet editor. Padding (button): set the inside padding for left, right, top and center in pixels from zero to ten. This dialog is identical to other padding choices dialogs throughout the style sheet editor.
192
The first step is to create your style option names. Insert: press Insert to create a new name. Properties: press Properties to edit an existing name. Delete: press Delete to delete an existing name.
193
Up/Down: you may use the up and down arrow buttons to move a style name into the first position, which is the one that acts as the default. Grid Line Size: sets the lines within the data grid. Choose between zero and nine pixels.
Within the Properties for each of the style option names, you may set the following options:
Name: this allows you to rename the style option name. Background Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h. Text Alignment: choose from left, right, or center. Font (button): choose the color, style, weight, size and family from the dialog. This dialog- is identical to other font dialogs throughout the style sheet editor. Padding (button): set the inside padding for left, right, top and center in pixels from zero to ten. This dialog is identical to other padding choices dialogs throughout the style sheet editor.
194
Background Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h. Text Alignment: choose from left, right, or center. Font (button): choose the color, style, weight, size and family from the dialog. This dialog is identical to other font dialogs throughout the style sheet editor. Padding (button): set the exterior padding for left, right, top and center in pixels from zero to ten. This dialog is identical to other padding choices dialogs throughout the style sheet editor.
195
Background Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h. Text Alignment: choose from left, right, or center. Font (button): choose the color, style, weight, size and family from the dialog. This dialog is identical to other font dialogs throughout the style sheet editor. Padding (button): set the exterior padding for left, right, top and center in pixels from zero to ten. This dialog is identical to other padding choices dialogs throughout the style sheet editor.
196
CLARION/PHP Users Guide the background color outside the edit box. This applies to update forms only. For viewonly forms, the html places text formatted exactly to your specifications. The option of formatting color, etc. appears for data in update forms for three reasons: for consistency; for those who wish to edit the cell after generating the PHP page; and most importantly, for View Only forms and fields, which dispense with the control and simply print the data in the cell.
You may set the following options: Background Color: provides access to the Color picker dialog. Select a color from the boxes or specify a custom color. Remember that should you choose an item from the Standard Colors dropdown, such as desktop color, that this will be supported only by CSS 2.0 compliant browsers (browser versions 5.x and higher). Please note also that in some browsers, and in most operating systems, if the color depth is not set to 24 or 32 bit, there may be color substitutions.
Note that the color value returned by the picker will be hexadecimal (the Windows Color Picker uses decimal, but HTML uses hex), in blue-green-red order, prepended with a zero, and followed by an h. Text Alignment: choose from left, right, or center. Font (button): choose the color, style, weight, size and family from the dialog. This dialog is identical to other font dialogs throughout the style sheet editor. Padding (button): set the exterior padding for left, right, top and center in pixels from zero to ten. This dialog is identical to other padding choices dialogs throughout the style sheet editor.
197
Style Sheets
After defining at least one style sheet, you may press the button and choose your default global styles from the dropdown boxes. You may override the choices within each procedure. The style sheets specify color, style, alignment, and sizing for each of the components which appear in the generated pages. As you will note in the chapter that documents the Style Sheet Editor, Clarion/PHP allows you to customize the appearance of each individual element to if not the maximum allowable with HTML, then very close to it. Desktop developers may have to make a slight adjustment in their thinking in regards to differences between those controls allowed by the Windows operating system, and those provided under HTML 4.0 standards. We have tried to highlight the most major differences in this chapter on the Style Sheet Editor.
The choices to implement within this dialog are as follows: Global: sets the global style sheet choice if no other choice is set. List: sets the style sheet choice for browse procedures should the procedure not override. Form: sets the style sheet choice for update and query procedures should the procedure not override. Help: sets the style sheet choice for help text windows should the procedure not override; though should you create your own HTML help pages, they will not apply unless you link the style sheet and use the style names. Such a task is much easier with an HTML editor than using a text editor.
198
199
Index:
?WHR...................................................... 155 <a> .......................................................... 129 <A>.................................................. 135, 155 <br> ......................................................... 124 access level............................................... 59 Actions tab............................................... 142 Add Button................................................. 92 Add Procedure ........................................ 122 Additional Cell Style ................................ 132 Additional Parameters............................. 128 Additional Row Style ....................... 115, 132 Administration.......................................... 107 ADO................................. 44, 60, 63, 99, 107 Alert Text Message ................................. 151 alignment................................................. 179 Alignment ........................................ 131, 134 All Data.................................................... 121 ALT text ..................................................... 91 Annotated Examples ......................... 61, 179 Appearance ............................................. 148 application wizard........................................ 9 Ascending/Descending Sort.................... 130 Automatic Detail Link .............................. 133 Back Button ............................................... 88 Background Class ................................... 186 Body Tag ................................................. 183 Borders.................................................... 188 Browse extension template ............. 112, 113 Browse template ....................................... 64 Browse to Browse ..................................... 71 Builder page ............................................ 144 Calendar Popup ........................................ 93 Cannot be Null ........................................ 150 Caption ............................................ 149, 154 cascading style sheets .............................. 80 Cascading Style Sheets .............................. 7 CDONTS ................................................. 108 checkbox on query form.......................... 149 child browse .............................................. 71 Clear Filter............................................... 121 Clear Filter Prompt .................................... 92 client side validation .................... 12, 56, 150 Client/Server.............................................. 44 Color picker dialog .................................. 185 Column Header Text ............................... 130 column label ............................................191 Column Name..........................................134 Column to Test ........................................132 Column With Value to Return..................119 Combo Options........................................153 conditional row formatting .......................114 Conditional row formatting.......................114 connection builder ...................................100 Connection Builder ....................................14 connection object ................................44, 84 Connection Properties.............................100 connection string .........................................7 Control Location ......................................154 Control Name ..........................................154 Cookies....................................................105 Create column as a Link..........................128 Create Detail Link......................................91 Create this as a Link................................154 Create this Column as Link .....................134 Custom Controls......................................153 custom link...............................................133 Custom Link.....................................128, 155 Data Column to Pass ......................128, 154 Data Columns..........................................123 data dictionary ...........................................11 Data Records per HTML List.....................91 Data Row.................................................132 database dictionary ...............................9, 55 Debug mode ..............................................97 Default Cell Style .....................................132 Default Row Style ....................................114 Default SQL .............................................122 Delete ......................................................142 Delete Form...............................................70 Delete Row ..............................................147 Design Time HTML Template ...................79 Display Column .......................................153 do not populate............................................9 Do Not Populate ........................................12 Edit ..........................................................142 email ........................................................140 Email........................................................107 E-Mail ......................................................105 embed point.............................................145 Enable Cell Style .....................................132
200 Enable Security ....................................... 116 Enable Sorting by this Column................ 130 Enhanced ADO Error Reporting.............. 108 Enter Display Text................................... 154 Field Lookup Buttons ................................ 13 File Drop Lists ........................................... 13 file loaded list box.................................... 152 font .................................................. 179, 184 Font ......................................................... 182 Form Button Text ...................................... 94 Form Defaults............................................ 93 form extension......................................... 138 form fields.................................................. 81 Form Message Text .................................. 95 Form Primary Table ................................ 146 form template ............................................ 65 Form Titles ................................................ 95 Form Validation ......................................... 96 formatting ................................................ 179 Formatting Function ................................ 132 formatting options.................................... 179 formatting tags........................................... 51 generation ................................... 75, 80, 179 Generation........................................... 97, 98 global extension ........................................ 87 global extension template ......................... 14 global template .......................................... 63 Global Template ........................................ 63 greenbar .................................................. 115 header ..................................................... 190 help.......................................................... 145 Help ........................................................... 75 Help Link ................................................... 88 Help Pages................................................ 99 Help URL........................................... 75, 118 Hover....................................................... 181 HTML controls ........................................... 59 HTML design time template ...................... 14 HTML editor......................................... 59, 79 HTML Element ........................................ 152 HTML Form Element............................... 149 HTML Pages ............................................. 98 HTML parameter ....................................... 83 HTML run-time template ........................... 57 HTML template................................ 7, 59, 79 Hyperlink ................................................. 135 hyperlink colors ....................................... 181
CLARION/PHP Users Guide ID Value Column .....................................136 Image Button ...................................136, 156 Image Column .................................136, 156 Image Sizes.............................................110 images .......................................................56 Images.....................................................109 Include in the SQL Select But Do Not Display .................................................126 Include With Prior Column.......................126 input label ................................................195 Insert........................................................142 ISAM databases ........................................11 Javascript ..................................................12 JOIN ................................................119, 123 key .............................................................11 Key ............................................................65 Key to Pass .............................................128 LIKE.........................................................121 link .........................................71, 83, 85, 133 Link ............................................................68 links .......................................................7, 51 list defaults.................................................90 localhost ....................................................77 Location ...................................................134 locator........................................................92 Locator.....................................................120 Login Screen Text ...................................106 Lookup.....................................................151 Lookup SQL.............................................153 margins............................................185, 189 Maximum Characters ..............................150 merge ........................................................79 Must Be In File.........................................151 Must be in List ...........................................96 Must Be In List.........................................150 Must be in Numeric Range......................150 Must be in table .........................................15 Must be in Table ..................................58, 74 My Records .........56, 60, 114, 115, 140, 150 Navigation Bar ...........................................91 nbsp;........................................................125 No Records Found ....................................92 No Validation ...........................................150 Northwind sample database....116, 141, 148 Numeric Field ............................................96 Omit From QBF Page..............................149 Order clause ............................................123
CLARION/PHP Users Guide override ................................................... 113 Override................................................... 138 Padding ................................................... 189 Page Naming Conventions ....................... 84 Page Title ................................................ 118 parent browse............................................ 71 Parent Browse......................................... 145 Pass this Data ................................. 128, 154 pixels ....................................................... 131 Populate .................................................. 154 Populate From................................. 136, 154 Populated From............................... 119, 123 popup calendar ....................................... 110 popup window ........................................... 99 precision .................................................. 148 Primary File ............................................... 65 Primary Table .......................................... 120 Procedure Link ................................ 128, 154 Processor page ....................................... 144 Processor Pages....................................... 56 procs.htm.............................................. 77,83 QBF Procedure ....................................... 118 Query by Form ............................ 67, 70, 145 Query By Form Button .............................. 92 query form ................................................. 66 Range Limit ....................................... 71, 126 range select............................................... 67 Read Only ............................................... 149 read only form ......................................... 143 Regenerate SQL ............................. 122, 146 repeat add ............................................... 145 Repeat Add Mode ................................... 144 Required Field ..................................... 94, 96 resultset..................................................... 44 return mechanism ................................... 143 Return to Filtered Browse ....................... 143 Row Style ................................................ 114 Rows and Columns ................................. 150 Run Time HTML Template........................ 80 runtime user ID........................................ 100 scalable ..................................................... 60 Search ..................................................... 142 Search Mode ............................................. 94 secure http................................................. 60 security .............................................. 11, 140 Security ........................................... 114, 117 Security Level.................................. 105, 141
201 security model ...................................56, 103 security options..........................................14 security scheme ........................................59 select browse.......................73, 98, 118, 151 Select Mode Procedure...........................118 Select Options .........................................152 session variable.........................84, 116, 140 Session Variable to Pass ................128, 154 SESSION() ..............................................155 shopping cart ...........................................133 Show Help .................................................88 Site Title...................................................107 smtp.........................................................108 SQL .............................44, 60, 119, 122, 147 SQL date/time field..................................125 SQL for Selection ....................................147 Standard Colors ......................................185 stateless ................................................7, 83 Static Entry ......................................128, 154 status message .......................................144 status messages .....................................142 Status Text ................................................95 style sheet ...........................................7, 197 Style Sheet ................................................98 style sheet editor .....................................179 style sheets................................................57 Table With Image ....................................156 target .........................................................81 Target Column.........................................153 Target Language .......................................88 target page ..............................................144 template chains .........................................13 test/debug page.........................................77 Test/Debug page.......................................98 Text Alignment.........................................183 Text Decoration .......................................182 Text Transformation ................................182 timeout.......................................................59 token..........................................................80 Tool Tip....................................................149 Tool Tips....................................................91 tooltips .......................................................11 Tooltips ......................................................88 triggers.......................................................11 TRN file......................................................88 TRN files....................................................60 Type of Procedure...................................155
202 unencrypted............................................... 60 Unique ID Column................................... 153 Unique Key.............................................. 146 Update Form ....................................... 68, 70 URL ........................................................... 66 URL parameters........................................ 56 User Based Security ............................... 104 user defined variable............................... 145 User Table............................................... 104 Validity Checks............................................ 7
CLARION/PHP Users Guide Value Column ..........................................153 VBScript...................................................155 view ...........................................................11 View.........................................................142 View Form .................................................93 web designer .....................................57, 179 Where clause...........................................123 Width .......................................................131 window control types .................................12 Window Size..............................................98