David,

Basically I have found a way of making printable versions of every page in a
website I am currently working on (without a database etc), because I am
using a dreamweaver template the main content is always surrounded by:

<!-- #BeginEditable "content" -->
...
<!-- #EndEditable -->

Just a link on a page pointing at the script below:

<-- html -->
<?php
$file = fopen($HTTP_REFERER, "r");
if(!$file)die("Cannot open the file.");
$readfile = fread($file ,40000);
$searchfile = eregi("<!-- #BeginEditable \"content\" -->(.*)<!--
#EndEditable -->", $readfile ,$out);

echo $out[0];
?>
<-- html -->

My problem is that there is a bit of php code showing in the source view
which gives away some of my included files names which I really don't want
people seeing, especially clever  people like the ones on this list :) I
don't need the php in the printable version so if I can either eval it or
strip it out that would be nice.

Regards,


Joseph

-----Original Message-----
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Friday, 23 November 2001 2:28 PM
To: Joseph Blythe; [EMAIL PROTECTED]
Subject: Re: [PHP] strip php out of html


On Fri, 23 Nov 2001 14:10, Joseph Blythe wrote:
> Hello,
>
> Is there a way to strip only php code out of an html file? I know about
> strip_tags but its going to be alot of work to make the allowable list,
> as all I want to strip out is:
>
> <?php ... ?>
>
> I tried like so:
>
> eregi_replace ("<?php include(\"whatever.php\"); ?>", "", $string);
>
> but it didn't find it suppose because of the escape characters...
>
> Another option would be to find the php code evaluate it and then put
> the result back in the correct position, I sort of tried this with not
> much luck.
>
> Any ideas..
>
> Regards,
>
> Joseph

It sounds like you want to capture the output of the script - so you just
end up with what you would see in View Source???

Is this a one off thing, or what exactly is the problem you are trying to
solve?

--
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA

   Always draw your curves, then plot the data.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to