Re: replace
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: replace

From: <alexjaquet@gmail.com>
Date: Tue Apr 25 2006 - 18:25:48 CEST

thanks Justin for responding

-What is the context of this?

I want to open an html file, parse it and replace all
$LABEL{'label_name'} variables by the key values pairs who are placed
in an config config file I do this to *delete php code* in html page
(MVC2)

for example to store in an hash table the keys values I do :

sub loadLanguage {
    $lang = $query->param("lang");
    $lang = uc ($lang);
    open (FILE, "<$dirLang/$lang.conf") or die "cannot open file
$dirLang/$lang.conf";
    while (<FILE>) {
        (local our $label, local our $value) = split(/=/);
        $SERVER{$label} = $value;
    }
    close (FILE);
}
Received on Mon May 1 03:04:13 2006