TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Display PHP code in text area help. (http://www.talkphp.com/general/5327-display-php-code-text-area-help.html)

JayGarland 03-05-2010 05:26 PM

Display PHP code in text area help.
 
Hi, I have a text area, and I would like to display data from example.php into it, for example.

I want this to show in the text area, but obviously with my own.

<?php
$var = "var";
$var2 = "var";
?>

So basically, the PHP code from the file.
If anyone could help me with this, it would be greatly appreciated.

Village Idiot 03-05-2010 07:45 PM

Just echo what you need inside the form, someting like this

Code:

<textarea>
<?php echo "Hello World"; ?>
</textarea>


JayGarland 03-06-2010 09:22 AM

Quote:

Originally Posted by Village Idiot (Post 30148)
Just echo what you need inside the form, someting like this

Code:

<textarea>
<?php echo "Hello World"; ?>
</textarea>


That would work but I mean display the variables from an existing file, so when you update the code, the file is updated, therefore the text inside the text area is updated.

I have an alternative for now, just useful if anyone can help with the displaying of a complete php file.

EyeDentify 03-06-2010 10:41 AM

Perhaps you could get some use out of these PHP functions:

highlight_file():
http://se.php.net/manual/en/function.highlight-file.php

highlight_string():
http://se.php.net/manual/en/function...ght-string.php

Good luck :)


All times are GMT. The time now is 02:59 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0