Hi Teddy, you may try the following: Write into your conf-file: %assembly = ( title => 'Assembly language page', description => 'Download free manuals and tutorials for assembly language', ..... );
%basic = ( title => 'Basic and Visual Basic page', description => 'Download Basic and Visual Basic tutorials', ..... ); And in your main-skript which should be called with something like "context=basic or assembly or ..." as a parameter: use CGI; $q = new CGI; $context = $q->param(context); require "conf.txt"; open(READ, "conf.txt") or die "Error opening file: conf.txt, Errorcode: $!\n"; close(READ); if ($context eq "assembly") { %conf_data = %assembly ; } elsif ($context eq "basic") { %conf_data = %basic ; } print $q->header; print <<END_OF_HTML; <HTML> <HEAD> <TITLE>$conf_data{title}</TITLE> <META HTTP-EQUIV="Expires" CONTENT="0"> </HEAD> <BODY> <H1>$conf_data{description}</H1> </BODY> </HTML> END_OF_HTML ----- Original Message ----- From: "Octavian Rasnita" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, May 25, 2002 4:06 PM Subject: Getting content of a configuration file > Hi all, > > I want to use a configuration file for a script and maybe I look in the > wrong direction. Please tell me if I have a better solution. > > I want to make a script that generates HTML pages. I already have the script > but I need to manually enter the page title, the keywords, the description, > a page header and a footer manually. > > I want to get these strings from a configuration file. > In this configuration file I want to have the strings for all web pages. > > In the configuration file I am thinking to have something like: > > page=assembly > title=Assembly language page > keywords=assembly language code asm > description=Download free manuals and tutorials for assembly language > header=This is the header text > footer=This is the footer text > > page=basic > title=Basic and Visual Basic page > keywords=visual basic vb script ActiveX > description=Download Basic and Visual Basic tutorials > header=This is the page header > footer=This is the page footer > > .... > > Finally I would like to have something like: > > %assembly=(title=>'...', keywords=> '...', description=> '...', header=> > '...', footer=>'...'); > %basic=(title=>'...', keywords=> '...', description=> '...', header=> '...', > footer=>'...'); > .... > > However, I don't know if it is possible to generate variables like %assembly > .... on the fly (because in that configuration file I will add variables for > more pages. > > > But maybe I am looking in a wrong direction and I can have another solution. > > I thought I could put in the configuration file something like: > > assembly.title=Assembly language page > assembly.keywords=.... > assembly.description=... > > .... > then to split the part before the = sign where is the "." > > > Please tell me if you have a better idea for such a configuration file I > want. > > Thank you. > > Teddy, > [EMAIL PROTECTED] > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]