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:42:41 CEST

then I open the corresponding page ( I don't want to change the way I
work in perl I want to do it in php right now)):

sub loadMixTape {
        open (FILE, "<$dir/mix_tape.html") or die "cannot open file
$dir/mix_tape.html";
        local our $menu = loadMenu();
        my $string4 = weekNews ();
        local our $cats = getCat();
        local our $content;
        while (<FILE>) {
            s/\$LABEL{'([\w]+)'}/ exists $SERVER{$1} ? $SERVER{$1} : $1 /eg;
            s/\$LANG/$lang/g;
            s/\$OPTIONS{'categories'}/$cats/g;
            s/\$ERROR{'([\w]+)'}//g;
            s/\$ARTICLE{'main_menu'}/$menu/g;
            s/\$ARTICLE{'search'}//g;
            s/\$ARTICLE{'week_news'}/$string4/g;
            s/\$LINK{'admin'}/$LINK{'admin'}/g;
            s/\$SESSIONID/$session_id/g;
            $content .= $_;
        }
        $content = Compress::Zlib::memGzip($content) if $can_do_gzip; ;
        print "Content-Length: ", length($content) , "\n";
        print "Content-Encoding: gzip\n" ;
        print "Content-Type: text/html\n\n";
        print $content;
        close (FILE);
}
Received on Mon May 1 03:04:14 2006