Using PHP inside BBCodes With PHPBB3 GeShi

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
Anaror
Registered User
Posts: 8
Joined: Sat Mar 26, 2011 7:24 pm

Using PHP inside BBCodes With PHPBB3 GeShi

Post 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..
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51807
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Using PHP inside BBCodes With PHPBB3 GeShi

Post by stevemaury »

What is GeSHi?
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52228
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Using PHP inside BBCodes With PHPBB3 GeShi

Post 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()";
?>
Anaror
Registered User
Posts: 8
Joined: Sat Mar 26, 2011 7:24 pm

Re: Using PHP inside BBCodes With PHPBB3 GeShi

Post by Anaror »

oh wow, I didn't know i just had to add =php to the end. I'll try that out. Thanks!
Locked

Return to “[3.0.x] Support Forum”