Title: RE: witango-talk: Making a database dynamic
Gerard,

I have around 100 sites all running from a single database with one odbc connection. The trick is to template out the site and load variables at the first page from a search to spread to all the parameters you wish to have dynamic.

Example

I have a postarg in the url called siteid. The url will look something like:
http://blahbla.com/first.taf?siteid=1001

When the first page is hit, it queries the db and loads all parameters that match 1001 into variables. Things like table widths, bg colors, tablebackground colors, top menus or side menus,  headers info, templates to use, footer info, etc. etc. etc.. All refernces to the site are wrapped in the siteid 1001. I even have a taf I built that writes out a css file that will do my rollovers, font and font color info, table backgrounds using classes, etc. The css files are named, of course 1001.css. The variable that calls them would the be like so...

<link rel="stylesheet" href="" siteid>.css" TYPE="text/css">

So...

a very simple page would be...

<HTML>
<HEAD>
<TITLE><@VAR CompanyName></TITLE>
<link rel="stylesheet" href="" siteid>.css" TYPE="text/css">
</head>
<BODY bgcolor="<@VAR BodyBGColor">
<table class="main" <!-- from css-->width="<@VAR Main TableWidth>" border=0> 
<tr><td align=<@VAR MainTableAlign>>
<br>
<font class="mainheader">     <!-- from css-->
The <@VAR CompanyName><br>
Promotional Resource Site</font><br><br>
<font class="mainbody"><@VAR CompanyPhone></font>
<br><br>
<img src="" ComapnyLogo>>
<br><br><br>
<font class="mainbody">Your source for a variety of selling tools created to help you
educate your market and build your business.</font><br><br>
</tr></td>
</table>
</center>
</body>
</html>

All font and table classes are in the css all variables are stored in the db and called and loaded.

If you wish to have a separate domain name for each site, I use a redirect on the opening page to call the taf that loads the variables.

Once you have the templates layed out, you can build an input form and a taf to write out the css files relatively easy.

The only draw back to this method is that the variables only hold for as long as you have the timeout set. So I add an if action at the beginning of all files that check to make sure the <@VAR siteid> is loaded. If not, the user is directed to the opening page again to reload the variables.

I hope this is making sense. I wrote this for a client that needed to be able to add sites quickly. The old way was taking around 20 to 30 hours per site (by hand). The new way has sites up and running in about an hour. I even have different pricing structures for products, custom menus, custom headers and footers, different templates -- the whole shabang.

Hope this helps :-)


Hi Gerard,
 
AFAIK, creating an odbc datasource for each database is unavoidable. What you can do is make your datasource connection parameters variables. Right click on any of the database actions, choose 'set data source'. The right hand side of the dialogue lets you set the deployment data source. Uncheck 'Same as development', choose your data source type from the dropdown and specify the variables you want to use for data source name, username and password. To change all the database actions in a taf file at one time, ctrl-A to select all, then right click 'Set data source'.
 
So what variables are you going to use? The most common solution would be to have dsName, dsUsername dsPassword as application scoped variables, but scoping them as domain or user may also make sense depending on your situation.
 
This road does have a downside. You have to take your own measures to secure the ds parameters. Depending on your situation, it might not be great to have the ds password sitting in a plain text file on your web server. You may also need to add code to the start of every taf to verify the ds variables are present.
 
Good luck.
Simon
-----Original Message-----
From: Gerard Bohbot [mailto:[EMAIL PROTECTED]
Sent: 23 September 2003 20:06
To: [EMAIL PROTECTED]
Subject: witango-talk: Making a database dynamic

Hi,
 
I was wondering what the process is for making a database dynamic.
 
Situation:
 
Using Tango 2000 and Pervasive SQL.
 
Many identical web sites, residing on the same server, have an identical DB, with the same reference name in Tango, with different personal information & options stored in the DB.
 
How do I set it up so that depending on who's site it is, it will reference the correct DB for information without having to set up an ODBC for each.  I believe that what I want is for the taf information to be identical, but the reference to the DB to be set to a relative path.  Unfortunately, I don't know how to do this.
 
Thanks,
Gerard
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf



********************************************************************
This message is intended only for the use of the person(s) ("the intended
recipient(s)") to whom it is addressed. It may contain information which is
privileged and confidential within the meaning of applicable law. If you
are not the intended recipient, please contact the sender as soon as
possible. The views expressed in this communication may not necessarily
be the views held by LGCSB (Local Government Computer Services Board).

Any attachments have been checked by a virus scanner and appear to be
clean.
Please ensure that you also scan all messages, as LGCSB does not accept
any liability for contamination or damage to your systems.
********************************************************************

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf


-- 

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf

Reply via email to