To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
I am trying to use highlight_string to display PHP code and if the code has any double quotes in it, it gets marked up all wrong. Is there anyway to work around this? Thanks, Jeremy
__________________
He who listens well, speaks well.
try an addslashes before you use highlight_string.
__________________ http://www.burnt-popcorn.com
Learning to code is just that, a LEARNING experience. It is necessary to LOOK for the information you seek on your road to becoming a Guru.
I tried that and I'm back to square one. In square one...the markup for the PHP code was all wrong. It had over half of the code that I wanted marked up as a text string (red). Here is the code I'm trying to mark up:
This also happens to be the function right now as is. It works for nearly ALL PHP code. When I mark it up the way you suggested, from the end the end of line 4 (require once), all code from "; on that line is red. The way the funtion is now...it marksup properly but it will take the "\\" and turn it into "\" and it will take "\\\\" and turn it into "\\". This isn't a big problem and I could probably deal without fixing it BUT there has to be a way to use highlight_string to beautify ANY PHP code. Right now...I'm having to jump through hoops to do it and the way posted, works if you don't have "\\" or "\\\\". Got anymore ideas? Thanks, Jeremy
__________________
He who listens well, speaks well.