in reply to Re: Re: Re: Another Opinion Request...(config file)
in thread Another Opinion Request...(config file)
Something like that, and it would then go load each value for that type?get_page_content("some_type");
Each variables '$default_font_family' is the same name in the db: 'default_font_family'.$default_font_family = get_page_content("default_font_family");
Would that work? I don't think it would, but I have not tried it. Do you know off hand if it would work?my $type = shift; my $dbh = DB_File::connect(); $sth = $dbh->prepare (qq{ SELECT name,content FROM page_vars WHERE + type = ? }); $sth->execute($type); while ( my ($db_name,$db_content) = $sth->fetchrow_hashref() ) { ${$db_name} = $db_content; } $sth->finish(); return 1;
Then I could just have each variable instead of being called by the name be called by a hash:my $type = shift; my $dbh = DB_File::connect(); $sth = $dbh->prepare (qq{ SELECT name,content FROM page_vars WHERE + type = ? }); $sth->execute($type); my %vars; while (my ($db_name,$db_content) = $sth->fetchrow_hashref()) { $vars{$db_name} = $db_content; } $sth->finish(); return(%vars);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Another Opinion Request...(config file)
by draconis (Scribe) on May 13, 2003 at 15:13 UTC |