Re: Re: str_replace
| From: | Sebastian | Date: | Sat, 15 Mar 2003 19:27:53 +0000 |
| Subject: | Re: Re: str_replace | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139805@lists.php.net to get a copy of this message | ||
Thank you, that seems to work fairly well :)
cheers,
- Sebastian
----- Original Message -----
From: "Ernest E Vogelsinger"
| 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/
|
|