RE: [PHP] Re: str_replace

From: Date: Mon, 17 Mar 2003 13:09:19 +0000
Subject: RE: [PHP] Re: str_replace
Groups: php.general 
Request: Send a blank email to php-general+get-139946@lists.php.net to get a copy of this message
> -----Original Message----- > From: Sebastian [mailto:sebastian@dslr.net] > Sent: 15 March 2003 06:23 > > > 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"); ?> Well, on the whole, if you don't want to do something based on a particular condition, then -- er -- just don't do it: <?php include("../config.php"); if(!$_GET[action] == "print") { include("$header"); } ?> // html <?php if(!$_GET[action] == "print") { include("$footer"); } ?> Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#139946) next »