PDA

View Full Version : Custom BBcode to display template


Apophis
07-26-2007, 07:36 PM
I've got a problem I've been working on for the past few days to no avail. I wanted to give it a shot myself before taking the easy way out and just posting here.

I'm trying to create a new custom bbcode that will display the contents of a template when it's called. I tried to edit the class_bbcode.php file and add it in there but I couldn't seem to get it to work. I somewhat copied a few of the existing codes and modified them but in the end the template would never display even though I didn't get any errors.

This is what I tried:

Added the following after the // [QUOTE] code on line 2171 of class_bbcode.php


//
$tag_list['no_option']['ribbons'] = array(
'callback' => 'handle_bbcode_ribbons'
);


Added the following after the [quote] function around line 1355


function handle_bbcode_ribbons($ribbontext)
{
global $vbulletin, $show;

$template = 'tgribbons_display';
eval('$html = "' . fetch_template($template) . '";');
return $html;
}


When I try and use the [ribbons] tag the contents of the template do not display nor do I get an error. The tags themselves don't show up either and if I go back and edit the post they're not even present.

Any ideas what i'm missing/forgetting?

EDIT/UPDATE:

Okay, my code above actually works. It was the template I was calling that had the problem as it relies on another set of plugins to operate.

I answered my own question, but it seems others were looking to do something similar so this may help.