Re: Re: str_replace

From: Date: Sat, 15 Mar 2003 09:32:02 +0000
Subject: Re: Re: str_replace
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-139790@lists.php.net to get a copy of this message
At 07:23 15.03.2003, Sebastian said: --------------------[snip]-------------------- >doesn't work but also doesn't give any errors, I will try to explain what I >am trying to do: > >I am trying to remove the header and footer to create a "printer friendly >page" with just the content, here's what my pages look like, I need to >remove header and footer when they visit: file.php?action=print > ><?php >include("../config.php"); > >if($_GET[action] == "print") >{ > $header = str_replace('include("$header");', '', $header); > $footer = str_replace('include("$footer");', '', $footer); >} > >include("$header"); >?> > >// html > ><?php include("$footer"); ?> --------------------[snip]-------------------- Hmm - can't work because the variable "$header" doesn't include the string "include("$header");". Try it this way: <?php include("../config.php"); if($_GET[action] == "print") { $header = null; $footer = null; } if ($header) include($header); ?> // html <?php if ($footer) include($footer); ?> -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#139790) next »