PHP Management Enviroment

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

PHP Management Enviroment

Post 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.
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post 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
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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?
Post Reply