Board index   FAQ   Search  
Register  Login
Board index php forum :: Bar Free time

PHP syntax highlighting

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

Moderators: macek, egami, gesf

PHP syntax highlighting

Postby swirlee » 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.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby Oleg Butuzov » Mon Jul 14, 2003 12:16 am

GOOD! but i didnt see a Graziano long time ago. only he have access to ftp =(.
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

yes thank you!!!!

Postby ruturajv » Fri Aug 22, 2003 11:16 pm

And please tell me as well how would you do that in the code
:lol:
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby gesf » 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
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby Oleg Butuzov » 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;
?>

=)
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby gesf » 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!
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby sigix » 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!
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Postby admin » 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
admin
Site Admin
Site Admin
 
Posts: 123
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome, Italy

Postby WiZARD » 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
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby swirlee » Sun Feb 22, 2004 2:29 am

[php]<?php
$text = "<em>Oh, this is so awesome.</em>\n";
echo $text;
?>[/php]
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby sigix » 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.
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Postby admin » 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
User avatar
admin
Site Admin
Site Admin
 
Posts: 123
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome, Italy

Postby Oleg Butuzov » Mon Feb 23, 2004 2:43 am

I see a some bugs (white points in buttons) in theme. today i will fix it.
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby gesf » 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!
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

echo all around

Postby ruturajv » Tue Feb 24, 2004 6:03 am

[php]

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

[/php]
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby sigix » Sun Feb 29, 2004 5:59 am

syntax highlighting is not working in other forums. (please correct me if i'm wrong)
:?
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Postby swirlee » Sun Feb 29, 2004 12:50 pm

It seems to be working fine to me.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby gesf » 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]
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby admin » Thu Mar 11, 2004 1:46 am

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

Bye
Graziano
User avatar
admin
Site Admin
Site Admin
 
Posts: 123
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome, Italy

Postby gesf » 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);
;)
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby admin » 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
admin
Site Admin
Site Admin
 
Posts: 123
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome, Italy

Postby gesf » 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
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

php tags....

Postby ruturajv » Mon Apr 26, 2004 7:53 pm

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

if they are what are the tags ???
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby Ben » 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 ..
Ben
New php-forum User
New php-forum User
 
Posts: 41
Joined: Mon Jul 26, 2004 2:37 pm
Location: Remagen / Germany


Return to Free time

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.