DBtoWEB Version 1.3 Documentation


1. DBtoWEB Settings...
   1.1  Specifying a Data Source (wizard step 1)

   1.2  Specifying the Main Table (wizard step 2)
   1.3  Specifying the Template and Generated Fields (wizard step 3)
   1.4  Generating the Pages
   1.5  Saving your Settings


2. Running DBtoWEB Unattended

3. Templates Tags...
   3.1  Including data from the main table
    MAIN_FIELD
   3.2  Tags for creating a repeating section
    REPEAT
    REPEAT_FIELD
    REPEAT ELSE
    END REPEAT
   3.3  Tags for conditional output
    START IF
    ELSE
    END IF
   3.4  Including the date of page generation
    TODAYS DATE

 

1. DBtoWEB Settings...

1.1  Specifying your Data Source (wizard step 1)

Once you have your template and database ready, run DBtoWEB.  You first need to specify the data source you want to use.  You can either choose an MS Access database or an ODBC data source (do not use an MS Access database via ODBC... there are known problems about using this method).

1) MS Access Database - enter the full path and filename of the database
2) ODBC DSN - enter the name of the data source configured in ODBC admin tool

After selecting the database press a connecton will be made to the database.  If there is a problem opening the database you'll recieve an error, otherwise you'll be able to specify the main table.


1.2  Specifying the Main Table (wizard step 2)
You now choose whether you want to use a table, query or SQL statement where each row in the recordset contains a template name and generated page name.  Once you have chosen this the template and generated field lists will be populated from fields in the main table you specified.



1.3  Specifying the Template and Generated Fields (wizard step 3)
The fields containing the template name and generated page name must now be selected from the lists of database fields.  If the template/generated page names do not include a path to the files, you must specify them.


If you are using the wizard you can now press 'Finish' to transfer your settings to the main screen.

Note:  If there is no path specified either here or in the database, DBtoWEB will fail to generate any pages.


1.4  Generating the Pages
Once you have entered all the settings you need (status bar at the bottom of the screen will read 'Query Ready to Run') you can generate the web pages by either pressing F5 or by selecting 'Run' and 'Generate' from the menu.  


As the pages are generated you'll see the status message change giving an indication of its progress through your database (if your database is relatively small you'll probably no see much before the completion message).

Any problems encountered in generating the pages will be reported in the errors area of the screen.


1.5  Saving your Settings
You can now save your settings to a file and re-load them next time you want to generate your pages.


2. Running DBtoWEB Unattended
If you have saved your settings to a file you can run DBtoWEB from the command line in the following way:

<path to dbtoweb>\dbtoweb.exe /auto<path to settings file>\<settings file>.d2w

e.g.

c:\program files\dbtoweb\dbtoweb.exe /autoc:\project\gen\mysettings.d2w


When you run DBtoWEB like this it will load the settings file, run the page generate operation, then exit.  This could be very useful where you have data that needs exporting every evening to keep your web pages up-to-date since you can use a program like Win-AT (in the Microsoft NT Resource Kit) to execute this command at a specified time every day.


3. Template Tags
The templates which DBtoWEB read are plain text files, they don't even need to contain any HTML so there are many more uses for this utility.

When DBtoWEB processes a template it is looking for tags.  These tags take the form of HTML comments, eg.  <!--TAG NAME-->.  DBtoWEB supports the following set of tags:

3.1  Including data from the main table

<!--MAIN_FIELD=field name--> This tag will be replaced with the value from the specified field in the MAIN table (from step 2 of the wizard).
e.g. <!--MAIN_FIELD=dept_name-->  will be replaced with a department name from the database.


3.2  Tags for creating a repeating section

<!--REPEAT=sql statement--> This tells DBtoWEB to start a repeating section based on a piece of SQL.

The SQL can include references to the MAIN table (which will be resolved to their actual values) by using a different type of tag in the format: 

#--MAIN_FIELD=
field_name--#
#--REPEAT_FIELD=
field_name--#
e.g. 1 <!--REPEAT=select * from staff-->
e.g. 2  <!--REPEAT=select * from staff where 
dept_id=#--MAIN_FIELD=dept_id--#
-->

 

<!--REPEAT_FIELD=field name--> This tag (which only applies inside a REPEAT section) will be replaced with the value from the specified field in the REPEAT query.
e.g. <!--REPEAT_FIELD=name-->   will be replaced by a persons name (from a particular depatment)

 

<!--REPEAT ELSE-->

DBtoWEB 1.2 Professional Feature

If no records are returned by the repeat SQL and this tag is specified, DBtoWEB will process any text between this and the <!--END REPEAT--> tag.

e.g. <!--REPEAT=select * from stf where dept=#--MAIN_FIELD=dept--#-->
     
Name: <!--REPEAT_FIELD=name-->
   <!--REPEAT ELSE-->
     
There is nobody in this department
   <!--END REPEAT-->


If no records are returned by the repeat statement the text between the <!--REPEAT ELSE--> and <!--END REPEAT--> tag will be output instead.

 

<!--END REPEAT--> This tells DBtoWEB to end the repeating section


3.3  Tags for conditional output


<!--START IF=
condition-->
DBtoWEB 1.2 Professional Feature

Within repeating sections you can specify IF statements which can make DBtoWEB skip over sections of the template.
Condition = expr operator expr
  Expr = string | number | field | function
  String = string of many words
  Operator= < | > | == | <>  
(higher than, lower than, equal to, not equal)
  Field =
Database field from either main table or current repeating section (e.g.
#--MAIN_FIELD=dept--# or #--REPEAT_FIELD=cust_name--#)

  Function = current_record_num  (the current record number in a repeating section)
             number_of_records   (the number of records in a repeating section)
e.g. <!--START IF=current_record_num=1-->   When this is put within a repeating section it will evaluate the expression and if on the first record of the repeat, it will process the text between this tag up to the ELSE or END IF tag.

e.g. <!--START IF=#--REPEAT_FIELD=manager--#==True-->   When the MANAGER field from the current record is set to True (as it would be with an Access Yes/No field type) then process the text.

 

<!--ELSE-->

DBtoWEB 1.2 Professional Feature

If the IF statement returns false, DBtoWEB will jump to the ELSE tag or END IF tag and continue to process text from the template.

e.g. <!--START IF=current_record_num=1-->
     
People in <!--REPEAT_FIELD=department-->
     
Name: <!--REPEAT_FIELD=name-->
   <!--ELSE-->
     
Name: <!--REPEAT_FIELD=name-->
   <!--END IF-->

On the first record of the repeating section two lines will be processed by DBtoWEB, on all other records just the text between the ELSE and END IF tags will be processed.

 

<!--END IF--> DBtoWEB 1.2 Professional Feature

Marks the end of an IF section.


3.4  Including the date of page generation

<!--TODAYS DATE=date--> Inserts todays date in the format specified. A complete listing of the date formats available is on a separate page together with examples.
e.g. <!--TODAYS DATE=d mmmm yyyy-->

Would be replaced with todays date, e.g. '30 January 1999'