Tabliz Samples Simple


Basic techniques sample

You can see the sample working on our site (please don't delete all records... :)
There is also a version of the this sample featuring Calendar and File Manager, look here

In the following tutorial we will describe how to manage one simple table coming from a relational Access Database. We will design both, the database and the ASP pages needed in order to manage them.

The Database

We 'll build a simple Database of Countries. We need two tables.

- a countries table with the following structure:

- a Continents Table with the following structure:

We 'll build only the interface for the Countries Table so we populate the Continets one with a few record like this:

Once the Tables are designed it is very important we design the relationship between them.

Open the Relationship Window and show table Continets and table Countries.

Now drag the IDContinent field of the table Continent over the IDContinent field of the Countiries Table.

The following window should appear:

It is very important that the left table is the Continents Table. This because when TaBliz will build our interface for the Countries table, it will also build a < select > from the tables related on the left.

So here is the rule. The "Central" or "Main Table" is always the one on the righ.
For tables on the left TaBliz will build one < select > for you.

Practice this in order to understand it better. This is a key feature of TaBliz.

Now you can click the “Create” button and save the database in a directory on your server. We will now save the database as "C:\Inetpub\wwwroot\databases\countries.mdb"

Important Note: If you are running on an NT Server and you want to grant access to your WEB DB Interface to anonymous users, then you have to grant read and write permissions to the "IUSR_YOUSERVERNAME" user for the directory of the mdb (in this case "C:\Inetpub\wwwroot\databases\").

We are done with the database.

Designing the WEB interface.

We need three ASP file in a virtual WEB with script execution permission and one include file.

The file names we will use are:

addnew.asp
list.asp
search.asp
customtabliz.inc

The code of addnew.asp , list.asp and search.asp is really self explaining so take a look at it:

search.asp code

<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<A HREF="list.asp">Show List</A> | <A HREF="addnew.asp">Add New Country</A>
<%
Set TBLZ = Server.CreateObject("Tabliz.AdminRecordset")
TBLZ.DatabasePath = "C:\Inetpub\wwwroot\databases\countries.mdb"
%>
<!--#include file="customtabliz.inc"-->
<%
TBLZ.recordset = "Countries"
tblz.DoSearchForm
%>
</BODY>
</HTML>

addnew.asp code

<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<A HREF="list.asp">Show List</A> | <A HREF="search.asp">Search</A>
<%
Set TBLZ = Server.CreateObject("Tabliz.AdminRecordset")
TBLZ.DatabasePath = "C:\Inetpub\wwwroot\databases\countries.mdb"
%>
<!--#include file="customtabliz.inc"-->
<%
TBLZ.recordset = "Countries"
tblz.AddNew
%>
</BODY>
</HTML>

list.asp code:

<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<A HREF="addnew.asp">Add New</A> | <A HREF="addnew.asp">Search</A>
<%
Set TBLZ = Server.CreateObject("Tabliz.AdminRecordset")
TBLZ.DatabasePath = "C:\Inetpub\wwwroot\databases\countries.mdb"
%>
<!--#include file="customtabliz.inc"-->
<%
TBLZ.recordset = "Countries"
tblz.DoEditingList
%>
</BODY>
</HTML>

As you’ve probably noticed all the files included the customtabliz.inc file. This is where the trick begins.

Let’s examin list.asp:

After some ordinary HTML code lines we instance an AdminRecordset object of Tabliz Like this:

Set TBLZ = Server.CreateObject("Tabliz.AdminRecordset")

Then we set the DatabasePath property:

TBLZ.DatabasePath = "C:\Inetpub\wwwroot\databases\countries.mdb"

it's time to include customtabliz.inc:

<!--#include file="customtabliz.inc"-->

customtabliz.inc contains properties assignement for all the properties that deals with the aspect of your Database’s WEB Interface. You can learn more about how customtabliz.inc works in the customtabliz.inc section of our site.

After this we can set the Recordset property an call the DoEditingList Method.

TBLZ.recordset = "Countries"
tblz.DoEditingList

We are finishd and as you see there was not to much work to do.

Bear always in mind that if you add a field to the countries table in the database, that field will be automatically managed by your WEB interface.

Also bear in mind that if you use the include directive you only need one customtabliz.inc for all your interface. Changing one parameter in it will affect all your WEB Database interface. One customtabliz.inc file comes with de distribution of TaBliz, so basicly you will change something here and there and then you'll forget about that file.