[solved] php highlight function help

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

ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

so it should be this?

Code: Select all

$code_count = preg_match_all( '#\[php\](.*?)\[\/php\]#si', $matches[1], $matches);

     $matches[1]= hc( htmlspecialchars2($matches[1]));
         return $matches[1];
    }
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Try it.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

it only echoing
Array 1
when i am telling it to parse other stuff
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

since no one would REALLY help me in my bbcode function :roll: , i searched on Google more, and found the solution my self! :D

the code is only 25 lines long, and it does whatever the pear version does! :D

ps. i didn't need preg_replace_callback()
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Glad you got it.

P.S, this thread is 8 pages long, there is only so much patience someone has. :wink:
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

ziggy3000 wrote:i searched on Google more, and found the solution my self! :D
Wow, you would have saved yourself a lot of time had you done that in the first place.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

i tried for a long time, and i read the comments and i found the answer in the comments!
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

now i got it to work as good as the bbcode editor in the phpbb forum

:drunk: :drunk: :drunk: :teach: :D :D

and i will try for it to highlight all sorts of languages, and make it work as good as the IPB bbcode edior
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

If you are going to do that, why not just use GeSHi?
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

i think that geshi makes the whole page look awful. i prefer to use a highlighter like the built in php highlighter. if you know any other highlighters(NOT GESHI), please let me know
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You realize that Geshi is extemely customizable?
Post Reply