PHP syntax highlighting

Bar discussions . Talk about everything not only php !. Guests are welcome here , forum registration is not required.

Moderators: egami, macek, gesf

Post Reply
User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Sun Jul 13, 2003 9:35 am

I would be eternally grateful if someone would install the PHP syntax highlighting add-on here. All-green code isn't the easiest thing to read. It takes about 10 minutes to install the mod and it's really easy. You can get it at phpBB.com.
Image

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Mon Jul 14, 2003 12:16 am

GOOD! but i didnt see a Graziano long time ago. only he have access to ftp =(.

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Fri Aug 22, 2003 11:16 pm

And please tell me as well how would you do that in the code
:lol:

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Thu Feb 19, 2004 3:37 am

Yeh it´s really needing a syntax highlighter!
I´ve used this one in my forum!
Php syntax highlighter MOD
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Thu Feb 19, 2004 3:50 am

<?
error_reporting(0);

function _my_($s,$a1,$a2) {
if ($a1!="<?") { $a1="<?"; $a2="?>"; }
$s=str_replace("\\\"","\"",$s);
ob_start();
highlight_string($a1.$s.$a2);
$s=ob_get_contents();
ob_end_clean();
return $s;
}

$str=preg_replace("!(\[php\]|<\?)(.*?)(\[/php\]|\?>)!ise","_my_('\\2','\\1','\\3')",$str);

echo $str;
?>

=)

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Thu Feb 19, 2004 5:29 am

Ok :p
Is that a joke or not!?
Well the code seems to work :)
Well, just because i´m having some proms making a BBcode converter to my website!
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

sigix
php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Fri Feb 20, 2004 2:44 am

Pejone wrote:GOOD! but i didnt see a Graziano long time ago. only he have access to ftp =(.

he replied to thethread on 18 feb 2k4

yah it will be very nice thing to to!
something strange will be ...

User avatar
admin
Site Admin
Site Admin
Posts: 122
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome

Sat Feb 21, 2004 3:09 am

Hello

I applied the mod (also if it works only for english language).
If you wish I can apply it on other languages (indicate me what language) , ok ?

Bye
Graziano

example
[php]
<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");
?>
[/php]

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Sat Feb 21, 2004 9:16 am

[php]
<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");
?>
[/php]
COOL! :D
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Sun Feb 22, 2004 2:29 am

[php]<?php
$text = "<em>Oh, this is so awesome.</em>\n";
echo $text;
?>[/php]
Image

sigix
php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Sun Feb 22, 2004 9:59 am

[php]<?php
echo "Looking great";
#php comments
?>[/php]
nice, new improvments in forum :D
pejone is also giving new php-forum theme presentation on monday.
something strange will be ...

User avatar
admin
Site Admin
Site Admin
Posts: 122
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome

Mon Feb 23, 2004 2:33 am

I installed also the new Pejone theme which looks great .
Tomorrow I will check if some mod has gone broken.


Bye
Graziano

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Mon Feb 23, 2004 2:43 am

I see a some bugs (white points in buttons) in theme. today i will fix it.

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Mon Feb 23, 2004 4:31 am

It´s good!
I think you should keep the 'code' and 'php' tags outside table, instead of this: [php]echo "bla bla";[/php]. I think it help a lot mainlly for that largest codes. well just an idea ;)
Anyway... great work!
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Tue Feb 24, 2004 6:03 am

[php]

<?php
echo "Hey.. this is great";
echo "How about using this in the \[code\] tags";
?>

[/php]

sigix
php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Sun Feb 29, 2004 5:59 am

syntax highlighting is not working in other forums. (please correct me if i'm wrong)
:?
something strange will be ...

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Sun Feb 29, 2004 12:50 pm

It seems to be working fine to me.
Image

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Sun Mar 07, 2004 12:24 pm

By the way, you got to add this in your forum/include/bbcode.php:

Code: Select all

$after_replace = str_replace('&amp;', '&', $after_replace);

If i remember right, was the change i made in mine!
Just because of this:
[php]<?
if($one && $two){
// bla
}
?>[/php]
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
admin
Site Admin
Site Admin
Posts: 122
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome

Thu Mar 11, 2004 1:46 am

Thank you gesf .
But where exactly I have to add that line :-o ?

Bye
Graziano

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Thu Mar 11, 2004 4:02 am

File 'bbcode.php' under 'include' directory in the forum folder!

As you have already added the PHP syntax highlighting, this may be correct:
Around lines 660-670. I made this i long time ago, but i´m almost sure is the only thing you need to do. Otherwise, see lines more in lines 680-690.

Edited:
I´m so stupid...sorry!
In that file, just FIND:

Code: Select all

$after_replace = str_replace('&gt;', '>', $after_replace);
And AFTER ADD:

Code: Select all

$after_replace = str_replace('&amp;', '&', $after_replace);
;)
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
admin
Site Admin
Site Admin
Posts: 122
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome

Tue Apr 13, 2004 1:38 am

Hello

I upgraded to latest phpbb 2.0.8a and there is some problem with [php][/php] tags .. :( Searching a solution ..
However [code][/code] works fine.


Bye
Graziano

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Tue Apr 13, 2004 4:27 am

What kind of error!? I´ll check that version code.
Anyway, see if it already has something to prevent the problem above!

Greetz,
gesf
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Mon Apr 26, 2004 7:53 pm

hey!!!
the php tags are not working... ?

if they are what are the tags ???

Ben
New php-forum User
New php-forum User
Posts: 41
Joined: Mon Jul 26, 2004 2:37 pm
Location: Remagen / Germany
Contact:

Mon Jul 26, 2004 3:24 pm

admin wrote:Searching a solution ..

hope you'll find one soon.

PHP-syntaxhighlightning is very needful i think, cause it increases lucidity
(don't know if it's the right english expression. please excuse. found the translation here: http://dict.leo.org/?p=2Ib6..&search=lucidity)

ben ..
my private website
Developer's Guide: Community, Portal, Helpdesk, Tutorials ...
----------------
English isn't my first language. Please excuse my way of expressing ..

Post Reply