Page 1 of 1

PHP Management Enviroment

Posted: Sat Dec 14, 2002 10:11 am
by Gen-ik
I am currently creating my own PHP management enviroment so that I can easily view, edit, and save changes to any PHP page(s) on my personal sites.. without having to constantly keep uploading files to see if they work.

Everything is running fine at the moment.. apart from one thing which is really getting my hair up!

I'm using a standard <textarea> to display the page I want to edit.. but the problem is the page I'm trying to display is executing it's PHP code before it gets displayed.. so I just see the final results and not the whole page.

Does anyone know a way around this?

Basically all I'm trying to do is READ and DISPLAY a PHP page without it executing.


This code I'm using for this at the moment is.....

Code: Select all

$OPEN=fopen($FILE, "r");
$CONTENT=fread($OPEN, 50000);  
fclose($OPEN);

echo("<textarea class=display rows=500 cols=150>");
echo($CONTENT);
echo("</textarea>");
......any help or suggestions would be appreciated.


Thank-you.

Posted: Sat Dec 14, 2002 1:29 pm
by BDKR
Hey there,

I tried a couple of different things and they look good. However, I also used a file that is pretty big so I think I hit the data limit of a text area in my browser.

Anyways, doing this worked...

Code: Select all

$file = file('dep_with.php');
echo "<hr><hr>";
echo("<textarea class=display rows=500 cols=150>");
while(list($key, $val)=each($file))
	{ echo strip_tags($val); }
echo("</textarea>");
This worked also...

Code: Select all

echo "<hr><hr>";
echo("<textarea class=display rows=500 cols=150>");
strip_tags(highlight_source('dep_with.php'));
echo("</textarea>");
You will definitely want to research into these options a bit more. And, like I mentioned before, I suspect there is an upper limit on how much data can inserted into a text area.

Cheers,
BDKR

Posted: Sat Dec 14, 2002 1:52 pm
by Gen-ik
Thanks.

I will try these out now and see if they work my side.

There shouldn't be a problem with the text-limit thing though as most of my PHP pages are of a reasonable size.. but who knows :)


Thanks again.

Posted: Sat Dec 14, 2002 3:05 pm
by Gen-ik
Nope not working.. didn't think it would be that easy :)

I've retried and checked all the variables a few times but I still get the following errors.

This code just displays the <title> of the page for reason..

Code: Select all

$file = file('dep_with.php'); 
echo "<hr><hr>"; 
echo("<textarea class=display rows=500 cols=150>"); 
while(list($key, $val)=each($file)) 
   { echo strip_tags($val); } 
echo("</textarea>");


..and this code doesn't work because PHP doesn't understand highlight_source..

Code: Select all

echo "<hr><hr>"; 
echo("<textarea class=display rows=500 cols=150>"); 
strip_tags(highlight_source('dep_with.php')); 
echo("</textarea>");


Any ideas?