Gossamer Forum
Home : Products : DBMan SQL : Discussion :

one database multiply html

Quote Reply
one database multiply html
I am using 36 different databases to cover different categories of products ...computers, clothing, books, etc. I am sure this is not the way to run a database.

What i would love to do is have one database ie. one cfg, one db.pl one auth.pl, and "multiple html"

please tell me how i can do this. please use the above databases COMPUTER, CLOTHING, BOOKS to illustrate.

I am a novice so please be detailed

Everton
Quote Reply
Re: one database multiply html In reply to
Basically, it would be a matter of adding conditional statements in the one html.pl file, like the following:

Code:

if ($IN->('db') eq "somedatabase") {
DO SOMETHING
}
elsif ($IN->('db') eq "somethelse") {
DO SOMETHING ELSE
}
else {
DO DEFAULT
}


These codes could be applied in each subroutine in the html.pl.

OR You could use mulitple html.pl by adding the following codes in the default.cfg file:

Code:

if ($IN->('db') eq "somedatabase") {
require "/full/path/to/somedatabase.pl";
}
elsif ($IN->('db') eq "somethelse") {
require "/full/path/to/somethelse.pl";
}
else {
require "/full/path/to/default.pl
}


BTW: This project would be more easily managed with LINKS SQL.


========================================
Buh Bye!

Cheers,
Me

Last edited by:

AnthroRules: Sep 9, 2001, 9:23 AM
Quote Reply
Re: one database multiply html In reply to
Ya keep missing those params :)


Quote Reply
Re: one database multiply html In reply to
Yea, if I could EDIT my posts, I would've, PAUL. Tongue


========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: one database multiply html In reply to
Too much work done already with DBMAN SQL and numerous hours of modifications

I will be going with multiple html because of how each each html is structure.

Question 1.

so my question is, where in the cfg do i put the the below :-

if ($IN->('db') eq "somedatabase") {
require "/full/path/to/somedatabase.pl";
}
elsif ($IN->('db') eq "somethelse") {
require "/full/path/to/somethelse.pl";
}
else {
require "/full/path/to/default.pl
}


Question 2:

elsif ($IN->('db').... what does the "db" represented here...remembering that i will have "ONLY ONE DATABASE" does it mean repeating the "name" of the "ONE" database each time a new html is called?

db = name of the one database??

Question 3:

Did you leave out the closing Param from the above instruction you gave me?

please forgive my detail request but i am a novice and i want to be clear about this.


Everton

Quote Reply
Re: one database multiply html In reply to
Well if ya want the code to work you will need:

Code:
if ($IN->param('db') eq "somedatabase") {
require "/full/path/to/somedatabase.pl";
}
elsif ($IN->param('db') eq "somethelse") {
require "/full/path/to/somethelse.pl";
}
else {
require "/full/path/to/default.pl";
}

All you need to change is the path to the .pl file and the database name inside " "

However you could just use:

my $db = $IN->param('db');
-e "/path/to/$db.db" and require "/path/to/$db.db";

Last edited by:

PaulWilson: Sep 10, 2001, 4:04 AM
Quote Reply
Re: one database multiply html In reply to
Paul thanks for reply again...

but as i stated in my question i an a novice. please i beg your patience.

you ignored the first questions i asked...

1. where in the CFG file do i put the below codes
2. elsif ($IN->('db').... what does the "db" represented here...remembering that i will have "ONLY ONE DATABASE" is "db" the "name" of the "ONE" database repeated each time a new html is called?

3. does "somedatabase" & "somethelse" mean any name i choose to call the one of the html.pl

4. How do you call the each html from a static page outside the database

Paul could answer these "4" questions....

if ($IN->param('db') eq "somedatabase") {
require "/full/path/to/somedatabase.pl";
}
elsif ($IN->param('db') eq "somethelse") {
require "/full/path/to/somethelse.pl";
}
else {
require "/full/path/to/default.pl";
}


Let me tell you whats in my brain....I will have one database called "SHOPPINGMALL" in that database there is (one DB.PL) (one CFG) (one AUTH.PL) & ("three" HTML.PL) the 3 html(s) being - > clothing_html.pl , auto_html & books_html.pl

if you explain it this way i will most assuredly understand:->

USING "my senario" given, could you please replace in your above codes "db" , "somedatabase" ,
"somethelse" with words from my senario.

please dont loose patience with me...just chalk it up to a novice being plain dumb!

honestly i think if "each" of my questions are answered (watered down for a novice) i would then get it this time.

Everton