Welcome to the OXD Software Website
Free software, shareware and sourcecode!
MOODb.com
Moviegap.com
  Main 
  Products 
  Domains 
  Contact 

Products > CSV HTML Generator


 CSV HTML Generator v1.0.2 (Released September 3, 2000)

Generate websites based on simple comma separated files (CSV-files). Add your data to the CSV-files and generate all pages on your site in a matter of seconds. It's perfect for any site that list large quantities of information and haven't access to a website solution with database support, such as IIS/SQL Server.

It requires a decent amount of knowledge about HTML and programming, so if you've never even created a webpage before you shouldn't consider this tool an option.



Download OXD Software CSV HTML Generator v1.0.2 [1.7 Mb]



New features for v1.0.2:

- New formula types. MONTH, MONTH(uc), MONTH(lc), ODDEVEN, ENCODED
- CSV-fields can contain separators if enclosed by quotation marks
- <br> in the CSV-file inserts a blank row
- Make comments in the CSV-file with //
- Make comments in the CHG-file with //
- Indexed CSV-files
- Indexed BOOL formulas not always uppercase
- Basefiletags not always uppercase
- Basefiletags can insert files
- Fixed bug when comma is used as separator
- It's possible to refresh sessions

New features for v1.0.1:

- Indexed CHG-tags, formulas and bodies.
- You can choose separator. Comma (,) or Semi-colon (;)
- Generator automatically searches for CHG-files.
- Improved status information
- It's possible to clear status


 How to use - MANUAL

This manual is divided up in different parts.

Introduction
File types
Indexed CHG-tags, formulas and bodies
Formulas in depth
Example 1
Example 2 - Indexed CHG-files
Tips and tricks



Introduction
This program is very flexible, and therefor also quite complex. But this doesn't mean it's hard to use. If you read this documentation and check out the examples you'll see the potential this software has.

Let's say that you have a number of HTML-pages with repeated information such as links pages. This page is a good example of this, and this page is another. What if there was a way to put all the repeated information in a CSV-file (a file with various data separated with a comma) and generate all your pages with just a few mouse clicks. It's easy to add new information, since you only modify the CSV-file, and it's also useful if you change the structure of your site and don't want to do small changes in hundreds of places.

Note that a future version of this tool will include a CHG Wizard that will
simplify the creation of CHG-files.


File types
There are three types of files you must know about:

Basefile - The main HTML file.
CSV-file - The file with your CSV data
CHG-file - Includes all formulas, tags etc.



The basefile is a normal HTML page that you would like to add CSV generated data to. You add any number of CHG-tags to the basefile. When you start generating the CHG-tags will be replaced with your CSV data code.

A CHG-tag looks like this: <!--OXD_CHG-->

If you want to insert CSV code to more than one place in the basefile
you can index your CHG-tags.

An indexed CHG-tag looks like this: <!--OXD_CHG:1-->

Note that indexed CHG-tags also requires indexed formulas and bodies.
Read more about this in indexed CHG-tags, formulas and bodies.



Each row in a CSV-file is one item.
Different fields for each item is separated by a comma (,) or a semi-colon (;).
The default is comma (,) but can be changed in the generator.
Use FORMULAS in the CHG-file to select actions for each CSV-value.



Here's an explanation of the CHG-file.

The CHG-file includes the following items:
SETTINGS, CSVFILE, BASEFILE, FORMULAS, BODY, BASEFILETAGS.

The SETTINGS can be used for various settings. At this point there are two settings and they are OutputFolder and FileExtension.

  SETTINGS:
  OutputFolder=c:\mywebsite
  FileExtension=.shtm


The CSVFILE is the name of the CSV-file.

  CSVFILE:
  nameofcsvfile.csv


The BASEFILE is the name of the basefile.

  BASEFILE:
  nameofbasefile.htm


The generator uses FORMULAS to assign CSV-data to different actions.
The syntax is: @TAG=CSV:n;TYPE=x
n is the number of where in the CSV file the generator should look for data
x is the TYPE. Available types are TEXT, BOOL, MONTH, ODDEVEN, ENCODED.

  FORMULAS:
  @NAME=CSV:1;TYPE=TEXT
  @SHOWIMAGE=CSV:2;TYPE=BOOL;TRUE=<img src="new.gif">;FALSE=NONE


Read more about using formulas in formulas in depth.


The BODY is the HTML code that will be inserted for each CSV value.
In the body you can add any number of tags that later will be replaced with CSV data.

  BODY:
  <p>
  <a href="@URL" target="_top" class="a"> @NAME</a><br>
  @DESCRIPTION @SHOWIMAGE
  </p>

BASEFILETAGS are tags that can be put anywhere in the basefile and will be replaced with a specific value in the CHG-file.

  BASEFILETAGS:
  @TITLE=My free links page
  @MENU=FILE("Data/Menu.htm")



Indexed CHG-tags, formulas and bodies
If you want to insert CSV data to more than one place in the basefile you can use index.

The CHG-tags you insert to the basefile must look like this:
<!--OXD_CHG:n-->
n is replaced with the number of your choice.

The formulas and bodies are indexed like this:
FORMULAS(n)
BODY(n)
n is replaced with the same number you used for the CHG-tag.


Lets assume you would like to add data in two different places in your basefile.
You add two CHG-tags at different places in the basefile that look like this:
<!--OXD_CHG:1-->
<!--OXD_CHG:2-->

And in your CHG-file you add two formulas and two bodies:
FORMULAS(1):
'the formulas for index 1
FORMULAS(2):
'the formulas for index 2
BODY(1)
'the body for index 1
BODY(2)
'the body for index 2



Formulas in depth
TEXT formula is the simplest type of formula. It looks like this:
@TAG=CSV:n;TYPE=TEXT
n is the number of where in the CSV-file you can find the data you want to show.



BOOL formula is a more advanced type of formula. It looks like this: @TAG=CSV:n;TYPE=BOOL;TRUE=x;FALSE=y
n is the number of where in the CSV-file you can find the boolean value.
x is what you want to do in case the CSV:n value is TRUE
y is what you want to do in case the CSV:n value is FALSE

NOTE! The BOOL value in the CSV-file is represented by 1 or 0.
If you want the BOOL value to be TRUE, make it a 1.
If you want the BOOL value to be FALSE, make it a 0.

A simple example:
You have an image called new.gif that you want to show after some of your data.
Construct a formula that looks like this:
@NEW=CSV:n;TYPE=BOOL;TRUE=<img src="new.gif">;FALSE=NONE
n should point to a value in the CSV-file that is either 1 (TRUE) or 0 (FALSE).
In this case, if n points to a 1 the TRUE condition is met, and the new.gif image is shown.
If n points to a 0 the FALSE condition is met, and nothing will be shown.

Add a formula to a BOOL formula condition.
I think I'll explain this best with an example.

Lets say you have a CSV-field that indicates if you should show a date. And in that case you want to insert the date from the CSV-file.
It looks like this:
@SHOWDATE=CSV:n;TYPE=BOOL;TRUE=@DATE;FALSE=NONE
@DATE=CSV:x;TYPE=TEXT
The generator first checks the CSV-file at the n:th position for a 1 or 0.
If it's a 0 nothing happens, if it's a 1 it sees that it points to a tag called @DATE.
The generator then checks the following formula line for a TEXT tag called @DATE and in that case inserts the data from the x:th position in the CSV-file.

NOTE! If @SHOWDATE is not immediately followed by @DATE then both tags will be discarded. @DATE must be of TYPE=TEXT.



MONTH formula:
With this formula you can convert numbers between 1 and 12 to months.
@MONTH=CSV:n;TYPE=MONTH
If the CSV-field at the n:th position is 2 the result will be February.
You can also force the result to UPPERCASE or lowercase. @UPPERCASEMONTH=CSV:n;TYPE=MONTH(uc)
@LOWERCASEMONTH=CSV:n;TYPE=MONTH(lc)



ODDEVEN formula:
Sometimes you want to alternate background colors for each item to make the pages more readable.
This formula depends on if the CSV-field is odd or even.
@COLOR=DATA:FFCC00,FF00CC;TYPE=ODDEVEN
Note that this formula doesn't get its data from the CSV-file. The first value after "DATA:" is what will be inserted when the CSV-field is odd, and the second value that is found directly after the comma separator is what will be inserted when the CSV-field is even.



ENCODED formula:
Use this formula to encode e-mail adresses. All e-mail adresses will still be viewable by any browser but will make them safe from any spam-bots that cruise the web in search for e-mail adresses to add to their spam mailing lists.
@MAILTO=CSV:n;TYPE=ENCODED



Example 1
Create a subfolder in the CSV HTML Generator folder called 'test'.
Here you'll place all your files.

You have a HTML file that you would like to insert CSV data to. This is your basefile.
Name the file basefile.htm and save it in your 'test' folder.
Add a CHG-tag to the basefile that look like this: <!--OXD_CHG-->

Lets say you want to create two freeware pages with the generator.
The two pages will be named free_links and free_software.
To do this you need to create two CHG-files. One for each page.

  free_links.chg
  free_software.chg

When you start the CSV HTML Generator later on and load the 'test' session all CHG-files in the 'test' folder will appear in the CHG-files box.

You decide what data should be added to the CSV-file. In this example it is:
Name, URL, Description and a small icon indicating that it's a new item.

The CSV-file might look something like this:

  Movie Organizer,0,http://www.movieorganizer.com,Organize your movie collection
  CSV HTML Generator,1,http://www.oxdsoftware.com,Create HTML pages based on CSV files

The first CSV value is Name
The second CSV value is a boolean value indicated by 1 for TRUE, and 0 for FALSE
The third CSV value is the URL
The fourth CSV value is the description

Then create a CHG-file.
This is free_links.chg, but you can easily create free_software.chg with the same principles.

  CSVFILE:
  free_links.csv

  BASEFILE:
  basefile.htm

  FORMULAS:
  @NAME=CSV:1;TYPE=TEXT
  @NEW=CSV:2;TYPE=BOOL;TRUE=<img src="new.gif">;FALSE=NONE
  @URL=CSV:3;TYPE=TEXT
  @DESCRIPTION=CSV:4;TYPE=TEXT

  BODY:
  <p>
  <a href="@URL" target="_top" class="a"> @NAME</a><br>
  @DESCRIPTION @NEW
  </p>

  BASEFILETAGS:
  @TITLE=My free links page

Below CSVFILE you'll see the name of the CSV-file corrsponding to this CHG-file. To simplify, I've named it the same as the CHG-file, but you don't have to.

Below BASEFILE you'll see the name of the basefile. This file can of course be named anything you want. You can use the same basefile for many of your pages.

Below FORMULAS you assign the values in the CSV-file with TAGS.
These tags are later used in the body to insert data.

The first row in FORMULAS assigns the tag @NAME to CSV value 1, TYPE is set to TEXT.
The second row assigns the tag @NEW to CSV value 2, TYPE is set to BOOL.
The third row assigns the tag @URL to CSV value 3, TYPE is set to TEXT.
The fourth row assigns the tag @DESCRIPTION to CSV value 4, TYPE is set to TEXT.

For more information about formulas see the formulas in depth section.

Below BODY you see the HTML code that is inserted for each CSV value.
Where it says @URL the program will check the formulas for the @URL tag. As you can see the formula points to the third CSV value which is, you guessed it, the URL.
The rest of the body is no difficult task to understand if you know any HTML.

The BASEFILETAGS section is the final part. This is if you're using the same basefile for many pages and still would like them to differ in some way. In this example the basefile includes a @TITLE tag, which is replaced by the text 'My free links page'.


Now over to the simple part.
1) Start the CSV HTML Generator
2) Enter 'test' in the 'Name of Session' field. (The folder you created earlier.)
3) Press the Load Session button. All CHG-files in the 'test' folder will be loaded.
4) Select free_links.
5) Click generate.

You're finished.
free_links.htm can be found in the 'Generated' folder.


The <!--OXD_CHG--> tag in the basefile has been replaced with the following CSV code:

Movie Organizer
Organize your movie collection

CSV HTML Generator
Create HTML pages based on CSV files




Example 2 - Indexed CHG-files
This example requires that you understand what's going on in Example 1.

You would like to insert CSV data to two different places in the basefile.
Save a HTML file in your 'test' folder. This is your basefile.
Insert two CHG-tags somewhere in the basefile. The two tags looks like this:
<!--OXD_CHG:1-->
<!--OXD_CHG:2-->

Construct your CHG-file like this:

  CSVFILE:
  free_links.csv

  BASEFILE:
  basefile.htm

  FORMULAS(1):
  @NAME=CSV:1;TYPE=TEXT
  @NEW=CSV:2;TYPE=BOOL;TRUE=<img src="new.gif">;FALSE=NONE
  @URL=CSV:3;TYPE=TEXT
  @DESCRIPTION=CSV:4;TYPE=TEXT

  FORMULAS(2):
  @NAME=CSV:1;TYPE=TEXT
  @URL=CSV:3;TYPE=TEXT
  @DESCRIPTION=CSV:4;TYPE=TEXT

  BODY(1):
  <p>
  <a href="@URL" target="_top" class="a"> @NAME</a><br>
  @DESCRIPTION @NEW
  </p>

  BODY(2):
  <p>
  <a href="@URL" target="_top" class="a"> @NAME</a><br>
  @DESCRIPTION
  </p>

  BASEFILETAGS:
  @TITLE=My free links page

As you can see both FORMULAS and BODY is indexed.
FORMULAS(1) and BODY(1) is used to replace <!--OXD_CHG:1-->
FORMULAS(2) and BODY(2) is used to replace <!--OXD_CHG:2-->



Tips and tricks
All generated files are normally stored in a subfolder to your session called Generated. But if you would like the output to be somewhere else you can add a setting called OutputFolder to your CHG-file.
SETTINGS:
OutputFolder=c:\www\mywebsitefolder


If you prefer an extension like .shtml instead of .htm which is default you can add a setting called FileExtension to your CHG-file.
SETTINGS:
FileExtension=.shtml


Note that if you add several settings in your CHG-file they should all be placed under the same SETTING declarator. Like this:
SETTINGS:
OutputFolder=c:\www\mywebsitefolder
FileExtension=.shtml


You can use BASEFILETAGS to load files. Insert a basefiletag called @WHATEVER into your basefile and add this to your CHG-file:
BASEFILETAGS:
@WHATEVER=FILE("test.htm")
The @WHATEVER tag will be replaced with the content of the file test.htm.


If you have an indexed CHG-tag and the generator can't find a BODY or FORMULA with that number it will look for the non-indexed BODY or FORMULA and use this instead.


You can comment out parts of your CHG-file with //.
In the example below the @NEW formula will be ignored.
FORMULAS:
@NAME=CSV:1;TYPE=TEXT
//@NEW=CSV:2;TYPE=BOOL;TRUE=<img src="new.gif">;FALSE=NONE
@URL=CSV:3;TYPE=TEXT
@DESCRIPTION=CSV:4;TYPE=TEXT


You can comment out parts of your CSV-file with //.
In the example below the Movie Organizer value will be ignored.
//Movie Organizer,0,http://www.movieorganizer.com,Organize your movie collection
CSV HTML Generator,1,http://www.oxdsoftware.com,Create HTML pages based on CSV files


Insert <br> into your CSV-file if you want a blank row.
Movie Organizer,0,http://www.movieorganizer.com,Organize your movie collection
<br>
CSV HTML Generator,1,http://www.oxdsoftware.com,Create HTML pages based on CSV files


If you use a comma-sign as the separator and would like to insert commas into a CSV-field you will get errors unless you enclose the CSV-field with the commas with quotation marks.
MP3 Player,"Supports mp3, wav, ra etc"
Note that the example is TWO CSV-fields.
'MP3 Player' is the first, and 'Supports mp3, wav, ra etc' is the second.




Copyright © 1997-2007 OXD Software