FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


help with php needed





Ben
Hiya

does anybody know of a function that is like highlight_string but doesnt actually highlight the string in different colours, just shows the php code all in black.

Thanks,
Ben Very Happy
BlackSkad
I don't think such a function exists.
For highlight_string: just put that code in a variable (one way or antoher, don't know where you want to get that code. If you give more info, I could help you out.) and output that variable.

Or for highlight_file (all the code from the file comes into $code and is then outputted on the screen):
Code:
$code = join("", file('yourfile.php'));
echo "<pre>{$code}</pre>";
Ben
On my site, all my content is stored in a database. I have also built a script which will update this content through forms, etc.

Whenever i want to update a page, it queries the db, and puts the content in a variable. The code is displayed in a textbox.

Code:
<textarea>
<? echo $pagecontent; ?>
</textarea>



However, now I have made a content page with a textbox in it, and it mucks the whole system up.

Instead of just showing the code for the [content]textbox, it closes the main textbox with the ending tag of the [content]textbox.

Do you understand -- that was quite hard to explain.

I need a code or function that will show html/php without parsing it, but not a function for a file, like show_source() or highlight_file() for a string like highlight_string().
Stubru Freak
Don't really understand but...

htmlspecialchars?
BlackSkad
Oh, you want it to show the html-code in your browser? Like said before:

Code:
<textarea><?php echo htmlspecialchars($page_content) ?></textarea>
n0obie4life
Code:
<?php
$blah = highlight_string("string");
$str = array("<font color=#FFFFFF>", "<font color=#FF8000>", "<font color=#0000BB>", "<font color=#000000>", "<font color=#007700>", "<font color=#DD0000>", "</font>");
$blah = str_replace($str, "", $blah);

echo $blah;


$str is hardcoded for Frihost's PHP - http://frihost.com/phpinfo.php

Or maybe try

Code:
highlight_string( $blah, 1 )
Related topics
[HELP] PHP -> Scripting
Needing a Bit Og Help {PHP}!
need some help - php switch code
[man][help]PHP...
http://www.samisaada.frihost.net What you think?
help,php books
Help - Badly Needed
PhP for morons like me?
Please help. php script installation error
I need help yet again
CSS a:hover and tables problem. Help really needed?
[HELP] PHP (and some MyBB) Administration
Session directory permissions issue
[Help] php script to post to twitter
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.