Object oriented Smart Templates Engine
Smart Template Engine
Installation / Tips Database Engine Interface Smart Parser Engine
Step by step installation
Database (DE) mode FAQ
Templates (TE) mode FAQ
Examples
Tips
Admin interface
Actions Editor
Jump Editor
Mailing Editor
Key Fields
Syntax
How to use TE
How to use DE

(*) DE - Database Engine
(*) TE - Template Engine
     "Database Engine" Admin Interface  
ver. 1.81    User Guide   Support    Forum Java Script must be enabled!
Ignore old settings, fresh parsing.
Variables: Cross with this variables file.
Reparsing - New fields were added to source form, use default variables file to update with new values.
 SP.Engine model
 include() model
 cgi model
Working on ...tst.php .:. Use parse file
:: tst :: Actions
 Do MySQL 
Do not use
Show script errors

Go to after submit:

Host
DB Name
DB User
Password
Table
Log remote IP  
Log post time  
Insert IF =
Update IF =
Check errors on
Client side
Server side
  Errors output
Language
Position
Field
CSS
Mail to after submit:

Confirmation page
"Thank you" page

" Submit" button

 Field name, Type
Description
CSS Type
Size
Values Required
Empty vals
Alpha
Numeric
Min
Max
Email Regexp
0




1




4


gif jpg png swf psd bmp tiff
File size X Y
6




8




"File to process" button & field    top  

Hit button to choose a file with form (form-file) you need to parse or print here a name of a form-file. If file is local - use path from your www(public) root. For instance, if you have file www.server.ext/somedir/file.html - print /somedir/file.html
Remote files are supported also through http://, i.e you may use http://www.sremote_server.ext/form_file.html
"Ignore old settings, fresh parsing" checkbox  top

Will ignore variables file (even if exists) and load all data directly from source .html file.
Variables  top

You can use variables file, created for another form to import settings. Assume that you have already configured all fields, rules, actions, titles and databases for one of your form and would like to import some of those settings into new form. Just enter file name into "variables" field and FSave will load settings from this file.

For instance, mail rules, jumping, mysql, inputs rules
"Reparsing - New fields were added to source form, use default variables file to update with new values"  top

If you changed/added/deleted form field in your original file but do not want to configure everything again, do not want to set new rules, check this box. Then FSave will use settings from relative variables file but add/delete new fields and forms.

"Start parsing" button  top

Starting parsing proccess for form-file from the "File to process" field. Three options are available:

  •  "Ignore old settings, fresh parsing" and "Use this variables file" are OFF:
       FSave will parse the file from begin or load forms data from old variables file if exists
  •  "Ignore old settings, fresh parsing" is ON:
      FSave will parse source file from begin and ignore old settings from variables file even if exist
  •  "Cross with this variables file" is ON, Variables field contains :
       FSave will load forms data from another variables file (for more information see above).


    EXAMPLE: you'd like to parse /form_test.php with variables from /test_form.prs.php (already exists).
    Let assume that form_test.php contains Form1 form with a1, a2, a3 fields and Form2 and test_form.prs.php contains data about Form1 with a1,o1,a3 fields. Then FSave will load form_test.prs.php and test_form.prs.php and fill settings for Form1 and add a1,a3 fields from additional variables file test_form.prs.php to main data (filled from form_test.prs.php)
Get result  top

Starts parsing proccess to get variables file and updated source file

SP, Include, CGI model radiogroup  top

SP.Engine can manage input of data in a form in three modes:

  • SP mode
    There is only mode if you will use SP.TE on the same page
    That mode is equal to Include, but SP.TE makes caching and calls form's parser. I.e:

    [FORM__test ... ]
    <form name='test' action='form_file.php'>
    ...
    </form>
    [END__FORM__test]


    You can use form in Edit mode, use another templates fileds in the form and use form fields in another templates
  •  CGI mode
    - Form parser is called through action
    <form name='test' ... action='/sp/fcss.php' ... >
  •  INCLUDE mode
    - Form parser call is hidden by php output control functions. Example:

    <?ob_start();?>
    <form name='test' action='form_file.php'>
    ...
    </form>
    <?include "/sp/fcss.php";?>

    then form parser loads source, caches output and prints parsed output back to browser

    $fcss_source = ob_get_contents();
    ob_end_clean();


Information string  top

Messages:
Working on form_file - name of source file
Using parse file - FSave loads forms data matrix from exist variables file (check at the source file path)
Parsing from file - FSave get forms data by parsing form file
Intersect with vars_file - means that parser opens variables file vars_file and loads settings for forms and inputs with same name from it

Errors
:
Intersect file is wrong - data loaded from intersect variables file is wrong. It mights be you had to load it on a server like binary :)
Can't open intersect file - try to use another path :)
Parsed data is wrong - forms data matrix loaded from variables file is wrong
:: Form ::  top

It's a settings header for current form.
"Do not use" checkbox  top

If your source file contains several forms but you do not want to parse all of them, just check this box. Next time you will load form-file in FSave it hides this form.
"Show script errors" checkbox  top

Check this box to output parsing errors into form page
Anyway, SP.DE sends an email with error information to admin@domain
"Client side check" checkbox  top
Check if you need to check input values on client side by JavaScript and output errors in new pop-up window. FCSS will use your own rules set (Required, Alpha, Numeric, Min, Max, Regexp)
"Server side check" checkbox  top

Check if you need to check input values on server side and output errors to new page. FCSS will use your own rules set (Required, Alpha, Numeric, Min, Max, Regexp)

Errors output: Language  top

Choose output language for errors. There are english and portuguese (thanks to Luis P. Sousa, lpmac.com) languages right now
But you can easily make your own translation
There are special files like language.translation.php in SP folder. Just copy one of them, rename "language" part (for instance, myown.translation.php) and translate. Then SP.DE adds your translation file into this select
$checking_message["SS"] - Server side output messages
$checking_message["CS"] - Client side output messages
Error phrase can include three special fileds -
FNAME - field name
FMUST - correct value
FWRONG - entered value

Errors output: Position  top

Set position for server side error message relative to field: Above, Left, Right, Under
If you use form-file page in SP mode you can set a place for output error messages with {ERROR__fieldname} tag
Parser will ignore Error output position and prints error message in place of {ERROR__fieldname}
It's better to use {ERROR__} tag with [] operator because {ERROR__} will become empty {} in case of No error
And [] cuts off in case it includes empty {}.
I.e. [<span class="special">You'v make the error - {ERROR__fieldname}</span>]

Errors output: CSS  top

CSS for server side error messages. SP.DE prints out error messages in Bold, Red colored. Create special CSS class for errors and set it here to change default output
SP.DE will print <span class="error_css">Error message</span>
"Confirmation page" checkbox  top

Check to redirect after submition to the confirmation page. It will be the same page but form fields become values

"Thank you" page  top

If you want to redirect your form results to confirmation ("thank you") page, but need other than default output template - enter file name here.

IMPORTANT: Confirmation page must contains form with the same name as you could miss some inputs couse parser checks if fields exist in working on file and fill them.

"Submit" button  top

Text of your "submit" button at the confirmation stage.
"Add another actions" button  top

There are four form processing stages. CSS - checking input errors, CFM - output confirmation page, Mail - email sending, MySQL - loading data into a table. You can run your own php code before and at the end of each stage. Read Action description
Go to after submit: Select  top

Choose a jump name to edit or delete. Read Jumps description
Go to after submit: "Add"  top

Load link editor to add a new jump action
Go to after submit: "Edit"  top

Load link editor for selected jump action
Go to after submit: "Delete"  top

Click to delete selected jump action. (IMPORTANT: action will be deleted without warning and roll-back)
Mail to after submit: "Select"  top

Choose a MAIL TO: to edit or delete. Read Sending Mail description
Mail to after submit: "Add"  top

Click to load mail editor, to add new action if you'd like to send email confirmation after submitting the form.
Mail to after submit: "Edit"  top

Load mail editor for selected action
Mail to after submit: "Delete"  top

Click to delete selected mail action. (IMPORTANT: action will be deleted without warning and roll-back)

MySQL part  top

SP.DE could load data entered through the form into MySQL table

Firstly, you need to set MySQL access. There are two ways to use this function.

  • To set all DB access values - Host, DB Name, DB user, Password, Table.
  • Create file db.inc.php
    <?
    $FS_form["DBHost"] = "localhost";
    $FS_form["DBLogin"] = "login";
    $FS_form["DBPass"] = "pass";
    $FS_form["DBName"] = "dbname";
    ?>

    and place the file into form's file directory. DBTable loads from variables file anyway

    Choose at least one data field to be saved into table. FSave is trying to pick right choice in column "Type".
Following MySQL types are available:

  • NO MySQL - don't save this field into MySQL table. Default value for submit button.
  • COUNTER - short name for INTEGER AUTOINCREMENT
  • BOOL - in fact it's TINYINT (1) UNSIGNED. Default for checkboxes. If checked - save 1, otherwise - save 0
  • INT - UNSIGNED INTEGER
  • SIGNINT - SIGNED INTEGER
  • FLOAT - same as in MySQL
  • TIME - same as in MySQL
  • DATE - same as in MySQL
  • YEAR - same as in MySQL
  • DATETIME - same as in MySQL
  • TIMESTAMP - same as in MySQL
  • CHAR - depends on Size - CHAR or VARCHAR. Default for text, password inputs, select
  • TEXT - same as in MySQL. Default for TEXTAREA
  • ENUM - same as in MySQL, values list must be present in Values. Default for radio button
  • SET - same as in MySQL, values list must be present in Values.

    COUNTER, INT, SIGNINT, CHAR, TEXT actual MySQL type depends on Size. For instance, INT up to 256 will be TINYINT (3). Actual type printed in View fields box

As a rule, each table has data part and keys part that helps the script to build the structure of the database.

Example: you have a script for customers to access restricted part of your site, your tables contain USER_ID field and ID of logged-in users, saved into SESSION variables or maybe transfers into hidden variable. You can set FCSS to save user ID into MySQL table - just use Key fields editor.

But if you want to hidde some table's fields and do not show them on your form, FSave will generate an error message - use Key fields editor to load values for such fields.

Do MySQL checkbox  top

Check to make SP.DE do MySQL operations.
Host  top

MySQL host address. Use "localhost" in 99.99% cases.
DB Name  top

Enter MySQL database name

DB User  top

User name that has access to MySQL Database you set above
User must have correct permissions to access MySQL database, so be sure you have created the database, created the database user, and added the user to the database (edited users permissions).

Password   top

MySQL "DB user" password
Table  top

MySQL table name where form's data will be saved
Log IP  top

Check to append LogIP field into your MySQL table. FCSS will fill this field automatically by customer's remote IP.
Log TS  top

Check to append LogTS field into your MySQL table. FCSS will fill this field automatically by record change timestamp.
MySQL table rows box   top

Shows generated values to create mysql table.
Edit Key Fields button   top

Run Key Fields Editor where you can add, edit, delete to MySQL table key or calculated fields.
Refresh fields button   top

View MySQL table's Fields
If you plan some form fieds to save into MySQL table, i.e. you set MySQL type for some fields not to NO MySQL or(and) create some key fileds through Key Fields Editor - FSave builds and saves a definition of table rows relative to such fields to variables file automatical by 'Get Result' button. Press this button to view real MySQL types for your fields right now.
Create table button   top

Run create tables window. Use DB access settings or db.inc.php to create table. If table is already exist - asks for confirmation.

"Insert IF" & "Update IF" selects  top

You can set one of form's field and optional value as a flag to add/update record. It means that SP.DE will add/update if field you set will exist in form values - isset($_POST [field] ), and if you set à value - be equal to - $_POST [field] = 'key_value' :

  •  To make SP.DE will add record only when some checkbox was set (or some button was used to post a form) - choose this field name from the "Insert IF" pop-up menu.
  •  To make SP.DE will update record only when some checkbox was set (or some button was used to post a form) - choose this field name from the "Update IF" pop-up menu.

    Generally speaking, SQL DBs updates record via phrase like UPDATE filed=val,... WHERE keyfield=key.
    So, to update a table by form's data, related table must have a key field and a variable with the key must exist while form's data will be posted. In fact, the key can be transfered via $_POST, $_SESSION arrays.

    You can use Key fields editor to create the key field and set a source for key val.
    But when you set a field in "Update IF", FSave checks and creates key field 'ID'(COUNTER) if ommited. FSave also checks and creates a source for key val as $_POST ['ID'] if ommited. That is, a hidden field 'ID' with key as a value must be in the form.
    If you use form-file in SP mode, FSave adds such field after <form ...>. Then you only need to fill the form with SP.TE tags.
  •  To use the same form-file to add and to update records, choose one field for Insert action and another one - for Update.
    Example: add two submit buttons in the form, name one of your submit button as "Insert" and another one
    as "Update", parse form through FSave.php. If you have parsed form already - set "Reparsing" checkbox. Select "Insert" button for Insert IF and "Update" button for Update IF. Then if customer hit "Insert" - SP.DE will add record and if hit "Update" will update record. Assume that you set keys as described above.
By default, SP.DE adds record if no one field were set in Insert IF, Update IF.
Field name   top

Form's input (field) name got from input's "name" attribute. FSave puts input names list into variable file. SP.DE loads that list to proccess form. For Server Side Checking SP.DE checks form inputs name by name (from that list). So - don't change this name but you sure will change it in a source
Field type   top

Form's input (field) type got from input's "type" attribute, if ommit - sets to 'text'. SP.DE uses it in every stage, so - don't change this but you sure will change it in a source
Field description   top

Form's input (field) description. At while, SP.DE uses it in the Client Side Checking when opens Error Window. If description present - it prints instead of field name like in phrase "Field has error - error description".
Field class   top

Form's input (field) class got from input's "class" attribute. SP.DE uses it in Confirmation Stage, If class present, field value ouputs like
<span class='fieldclass'>value</span>
Field MySQL type   top

Available types describes in MySQL part
Just several notes: if you set INT, SIGNINT or FLOAT - don't miss to check Rule 'Numeric' to sure MySQL will get right value
Next: Not checked Checkbox doesn't send its value at all. That's why BOOL type exist. SP.DE checks this type on value present, if set - 1, not present - 0.
Note: If you have Select in your form - don't forget to set something in 'value' attributes or SP.DE receives nothing.
Field size   top

Form's input (field) size got from input's "size" attribute or calculated if not present (value size,rows*cols for textarea). FSave uses it to generate right MySQL type for table creation sentence.
Field values  top

Form's input (field) available values. Actual for radio and select inputs. It uses when you set ENUM or SET as MySQL type
Field Rule: Required   top

Check if value of this field must be present in POST and will not be empty
Field Rule: Empty val   top

Use with Required rule. Type here a value that SP.DE will interprete as empty. I.e. if field's value will be equal this val - SP.DE will print an error like Required.
It's useful for Select fileds when first select value is comment that needs to be changed.
Field Rule: Alpha   top

Check if value of this field must be alpha, i.e value contains only alpha symbols like A-Z,a-z,'_',spaces. you may combine alpha and numeric rules.
Field Rule: Numeric   top

Check if value of this field must be numeric, i.e. [-+][0-9][.][0-9]. you may combine alpha and numeric rules.
Field Rule: Min   top

Type here minimum length of value, if required. If Numeric Rule checked - works like mimimum barrier for value.
Field Rule: Max   top

Type here maximum length of value, if required. If Numeric Rule checked - works like maximum barrier for value.
Field Rule: Email   top

Check if value of this field must be an email address. Needs to say that if you don't combine this Rule with Required Rule so empty value accepted.
Field Rule: Reqexp   top

For special cases. Type here regular expression to check field value.

 1997-2004 © Copyright "H-2.com"    Developed by H-2.com