1
Pnooka
PHP syntax highlighting
  • 2005/10/11 21:11

  • Pnooka

  • Just popping in

  • Posts: 68

  • Since: 2004/7/16


I have searched high and low for a proper php code syntax highlighter to add into module.textsanitizer.php for a few days now, with no success at all. I even tried adding the Geshi source code highlighter, that didn't work well at all. Then i have tried the highlight_string, which is a built in function for php which i almost got working. So, now i could use some help to that highlight_string somehow merged into module.textsanitizer.php file as an extension for it.

2
JMorris
Re: PHP syntax highlighting
  • 2005/10/11 23:49

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Google is your friend.

Found in Google using: PHP syntax highlighting site:xoops.org

Link: Syntax highlighting hack for all XOOPS modules

Best Regards,

James
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

3
LazyBadger
Re: PHP syntax highlighting

Brr...
Geshi
* is better, less buggy and wider
* haven't external dependences
* Supported and live project

JMorris - be mderator only here, remember your hat, don't try to eat more than you can... you are ##OOPS## censor and even more ##OOPS## ##OOPS##.

If you dislike my opinion - kiss my ##OOPS##, ##OOPS## ##OOPS##!
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

4
JMorris
Re: PHP syntax highlighting
  • 2005/10/12 2:40

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Quote:

Quoted from XOOPSiquette:

Spamming and Trolling - We do not tolerate spamming or off-topic trolling in any forum. If you do this, you will be warned once, and any further abuse will result in your account being deactivated, or even your IP being banned from the sites.

Topics - Please stay on topic. For general conversation, please use the General Discussions forum.

Be Nice! - We pride ourselves in being a tight-knit community that polices itself well, and we want to keep it that way. This means showing respect to all members.


LB,

If you have a problem with me, take it up with me in PM. Please do not attack me, or any other member in the forums or in comments. If you have any further questions regarding XOOPSiquette, please either refer to XOOPSiquette, PM me, or PM another Core Team member.

Regards,

James
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

5
Pnooka
Re: PHP syntax highlighting
  • 2005/10/12 4:33

  • Pnooka

  • Just popping in

  • Posts: 68

  • Since: 2004/7/16


Well, i downloaded that Fractalizers highlighter, but don't like the idea of me having to install an external application fot it to work. After all, my webhost doesn't run PEAR, so that's a no go. And geshi is a bit tricky to set up. I only want to add a pice of code, very much like this one.
Quote:

function bb_php($str){
$str = str_replace("]\n", "]", $str);
$match = array('#\[php\](.*?)\[\/php\]#se');
$replace = array("'<div>'.highlight_string(stripslashes('$1'), true).'</div>'");
return preg_replace($match, $replace, $str);
}

6
Herko
Re: PHP syntax highlighting
  • 2005/10/12 13:40

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


LB: JMorris is doing exactly what the community asked of him, and left the messages intact while removing offending language. Don't start picking on him for doing what everyone here thinks is necessary and requested from him!

And don't even start on the whole censorship discussion, because you know as well as I do you're waaay off base there, leading nowhere. Nobody here ever restricted people to voice their opinions, as long as they voiced them according to the normal rules of inter-human communications.

If your own norms are lower and feel your opinion can only be voiced using profane language, you'll have to find onther place to voice it. If your opinion can be expressed with at least the respect you expect others to show you and without any bad language, you're free to express them here, as you have always been.
That doesn't mean we necessarily have to agree on your opinion, but we never have restricted your right to express it, within the limits of the XOOPSiquette.

JMorrid has my full support in this matter.

Herko

7
phppp
Re: PHP syntax highlighting
  • 2005/10/12 14:55

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


Quote:

Pnooka wrote:
Well, i downloaded that Fractalizers highlighter, but don't like the idea of me having to install an external application fot it to work. After all, my webhost doesn't run PEAR, so that's a no go. And geshi is a bit tricky to set up. I only want to add a pice of code, very much like this one.
Quote:

function bb_php($str){
$str = str_replace("]\n", "]", $str);
$match = array('#\[php\](.*?)\[\/php\]#se');
$replace = array("'<div>'.highlight_string(stripslashes('$1'), true).'</div>'");
return preg_replace($match, $replace, $str);
}


Hack for XOOPS 2.2 Chinese version:
https://xoops.org.cn/modules/wfdownloads/singlefile.php?lid=327

You could find relevant scripts in the package:
XOOPS/class/module.textsanitizer.php

8
Pnooka
Re: PHP syntax highlighting
  • 2005/10/12 15:14

  • Pnooka

  • Just popping in

  • Posts: 68

  • Since: 2004/7/16


Thank you very much phppp. I didn't find that, maybe because it was located at xoops.org.cn. Will try to modify my code to get that highlighter to work properly.

Login

Who's Online

224 user(s) are online (132 user(s) are browsing Support Forums)


Members: 0


Guests: 224


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits