Page 1 of 1

Using PHP inside BBCodes With PHPBB3 GeShi

Posted: Tue Feb 28, 2012 9:49 pm
by Anaror
Hi guys, soo I really want to use GeSHi inside of my BBCodes. But it's not loading right. I have uploaded GeSHi to my website and tried to create BBCodes to access but its not working. Is any form of PHP allowed in BBCodes? I know they are generally HTML codes but still?

Here is what I've tried.

BBCode usage:

Code: Select all

[PHP]{TEXT}[/PHP]
HTML replacement:

Code: Select all

<?php
include_once 'http://myfullwesbiteurlstuff4/geshi/geshi.php';
$source = {TEXT};
$language = 'php';
$geshi = new GeSHi($source, $language);
echo "$geshi->parse_code()";
?>
In my post I put this:
[php]$code = str_replace("\t", '&nbsp; &nbsp;', $code);
$code = str_replace(' ', '&nbsp; ', $code);
$code = str_replace(' ', ' &nbsp;', $code);
$code = str_replace("\n ", "\n&nbsp;", $code);[/php]

It outputs this instead of what I want:
$code = str_replace(' ', '&nbsp; ', $code);
$code = str_replace(' ', ' &nbsp;', $code);
$code = str_replace("\n ", "\n&nbsp;", $code);; $language = 'php'; $geshi = new GeSHi($source, $language); echo $geshi->parse_code(); ?>


Any ideas on how to make this work without a mod if possible?

Edit

--
Well I've discovered that using that full link for some reason effects it and it wont load..

Re: Using PHP inside BBCodes With PHPBB3 GeShi

Posted: Tue Feb 28, 2012 10:13 pm
by stevemaury
What is GeSHi?

Re: Using PHP inside BBCodes With PHPBB3 GeShi

Posted: Tue Feb 28, 2012 10:16 pm
by Brf
If you want fancy colored code, you can use the code=php tag

Code: Select all

<?php
include_once 'http://myfullwesbiteurlstuff4/geshi/geshi.php';
$source = {TEXT};
$language = 'php';
$geshi = new GeSHi($source, $language);
echo "$geshi->parse_code()";
?>

Re: Using PHP inside BBCodes With PHPBB3 GeShi

Posted: Tue Feb 28, 2012 10:24 pm
by Anaror
oh wow, I didn't know i just had to add =php to the end. I'll try that out. Thanks!