PHP syntax highlight code question

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
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

PHP syntax highlight code question

Post by like_duh44 »

Hi, I have a code bank where I want to highlight the php code. I came along this code: http://www.evilwalrus.com/viewcode.php?codeEx=319 and was wondering how the heck I would use it LOL. Would I just include it in the page that outputs the code and use one of the highlighter's functions or what? Thanks
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Well, I'd rather use something similiar to BigE's (the One) Highlight with Line Numbers snippet.

Works well when I tried it some time ago, and easier to learn from, aswell as does the trick.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Or you could easily create your own from scratch. ;)

highlight_string()
evilMind
Forum Contributor
Posts: 145
Joined: Fri Sep 19, 2003 10:09 am
Location: Earth

Post by evilMind »

highlight_file() or show_source() also work
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

I tried the highlight_string() command, but nothin happened. Do I have to change all the < and $gt; to < and >, respectively? It should still work, right? I checked the server, I'm running php 4.2.2 with highlight.string set. What am I doing wrong? You can check out the page here: http://www.vgapws1.myhost24.com/devcorn ... rstpost=46
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

when u use highlight_string(string[,donotshow) you have to specify a string for the function to highlight, and optionally, a boolean value that if it's true the highlighted string won't be printed out
Post Reply