PDA

View Full Version : Form Hack question: parsing BBCode in variables


IdealExchange
01-18-2008, 01:17 AM
I'm trying to edit the Form Hack mod such that it will parse BBCode and line breaks in the $formpurpose variable. I'll admit right now that while I do have a few years of programming experience under my belt, I'm quite new to PHP, so my apologies if this is a stupid question.

I have found that there is a function called bbcodeparse(), contained in functions.php, that does this. In order to use it, I must include global.php. So, I tried inserting the following code before the eval statement:
require('./global.php');
$formpurpose=bbcodeparse($formpurpose);

eval('print_output("' . fetch_template("$maintemplate") . '");');
No good; I get an undefined function error. So, newbie question though it may be, what am I doing wrong? Can someone show me the proper way to have Form Hack parse BBCode in the $formpurpose variable?

Your help is appreciated!

MoT3rror
01-18-2008, 02:15 AM
I did not find a function called bbcodeparse in the functions file.

The files you need to look at would be class_bbcode.php and functions_wysiwyg.php in the includes folder.

Try the convert_wysiwyg_html_to_bbcode (http://members.vbulletin.com/api/vBulletin/_includes_functions_wysiwyg_php.html#functionconve rt_wysiwyg_html_to_bbcode) function in the functions_wysiwyg.php.

IdealExchange
01-18-2008, 03:45 AM
Okay, so I tried this:
require('./global.php');
require('./class_bbcode.php');
require('./functions_wysiwyg.php');
convert_wysiwyg_html_to_bbcode ($formpurpose);
...with no luck; it's telling me that the libraries are not defined. Of course, I'm quite sure I went about it completely wrong; as I've already admitted, I'm new to PHP and have no idea what syntax I should be using. If it's not too much trouble, might someone supply some sample code so I can see what I need to be doing?

Dismounted
01-18-2008, 03:49 AM
I believe there is an article that explains things like this.

IdealExchange
01-18-2008, 04:56 AM
Well, there's a 51-page thread on the Form Hack mod, if that's what you mean. Beyond that, I've read through various PHP tutorials (including the one linked in the sticky about coding). That's how I've managed to make the modifications that I have. This is the only one remaining that's giving me trouble.

I've been poking at this problem for a while, and figured it wouldn't be any skin off the forum's back to help me out with what I thought was a relatively simple question; I was led to believe it was the official forum for support. My apologies.

Dismounted
01-18-2008, 05:41 AM
<a href="https://vborg.vbsupport.ru/showthread.php?t=82693" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=82693</a>

It's wonders what a simple search can do...