Hello, I am trying to make a add a tutorial on the fly system to my website… and I was wondering how do I make something like this?
print "Test";
echo 'test';
I am just wondering how to highlight the blocks of PHP code ect…
Hello, I am trying to make a add a tutorial on the fly system to my website… and I was wondering how do I make something like this?
print "Test";
echo 'test';
I am just wondering how to highlight the blocks of PHP code ect…
What you’re referring to is a plugin in vBulletin. I think there are other scripts that will do it for you though for non forum use. Try a google search.
Alright… any idea on what it may be called? just try PHP highlighting?
There’s a package called ‘code2html’, which can convert any code (PHP, C, C++, Java) to HTML - you have to run it once-per-file, so you can’t just do it on the fly…
The other option, and the one I tend to use most often, is to actually create a unique PHP file, and then symlink it to a .phps file, and then configure the webserver to do the highlighting for me… It’s built into PHP - files with the correct mime type will be highlighted automatically. The problem, then, is displaying that on your page.
o… alright…
well im going to go search around and see what I can find.
There is a function in PHP to do what you’re needing:
http://us3.php.net/highlight_string
Also, read the comments on that page, they are quite useful
Thanks!
cool little function!
show_source(basename($_SERVER['PHP_SELF']));
but as mentioned before, using highlight_string is better because it highlights it rather than just showing the code
it hightlights it aswell :), differants is that highlight_string only hightlights the string you want it to hightlight…
oh my bad :(, guess I should check before making dumb posts like that :P, but then what’s the difference between that and highlight_file?
edit: nevermind, they’re duplicates
Nothing dumb about it… can’t know it all
hightlight_file ( didnt even know that one lol )
The **highlight_file()** function prints out a syntax highlighted version of the code contained in filename using the colors defined in the built-in syntax highlighter for PHP.
If the second parameter return is set to **TRUE** then **highlight_file()** will return the highlighted code as a string instead of printing it out. If the second parameter is not set to **TRUE** then **highlight_file()** will return **TRUE** on success, **FALSE** on failure.
[size=1]ssssssssssssstt [/size]still learning Highlight_file for those who want to know
yep, just was looking at it, and a while back I forgot about the second parameter, man was that one long night until I figured that out
:: Copyright KIRUPA 2024 //--