![]() |
parse_bbcode
Hi, i'm new to hacking/modifying VB. Can someone tell me why the following code returns {i}test{/i}: (Note: i changed [ ] to { } so this forum doesnt parse it)
<?php require_once("forums/includes/functions.php"); require_once("forums/includes/functions_bbcodeparse.php"); echo parse_bbcode("{i}test{/i}"); ?> |
parse_bbcode parses code depending on the signature settings, or specific forumsettings
if you want to explicitly parse some code, you have to use parse_bbcode2 |
Quote:
|
functions_bbcodeparse.php ;)
|
Thanks Xenon,
<?php require_once("forums/includes/functions.php"); require_once("forums/includes/functions_bbcodeparse.php"); echo parse_bbcode2('test', 0, 0, 0, 1, 0, 1); ?> I wish i could say that worked but I get an error saying call to a member of a non-existant object. Looked into it, seems it tries to use the DB_Sql_vb class in db_mysql.php... So i figured if i instantiated that class and included config.php and db_mysql.php maybe the problem would go away... <?php require_once('forums/includes/config.php'); require_once('forums/includes/db_mysql.php'); $DB_site = new DB_Sql_vb; $DB_site->appname = 'vBulletin'; $DB_site->appshortname = 'vBulletin (' . VB_AREA . ')'; $DB_site->database = $dbname; $DB_site->connect($servername, $dbusername, $dbpassword, $usepconnect); require_once("forums/includes/functions.php"); require_once("forums/includes/functions_bbcodeparse.php"); echo parse_bbcode2('test', 0, 0, 0, 1, 0, 1); ?> When i do that i get the VB error: There seems to have been a slight problem with the database. Please try again by pressing the refresh button in your browser. An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists. We apologise for any inconvenience. |
When I tried that with this it gave me an error:
PHP Code:
|
bob, you may look at the signature of that function first ;)
@nsanden: you should require global.php before :) |
Quote:
|
You actually got it to work? Can you show me your working code?
I still can't get it to work... http://www.savingadvice.com/forums/test.php http://www.savingadvice.com/forums/test.php?source=1 |
Wow i take that back! Finally works!!! Appreciate the help guys.
|
How did you get it to work?
|
|
ah sorry bob, i just overlooked it ;)
take out the htmlspecial chars thing, as parse_bbcode2 has that built in as well ;) |
ok, but how do I change the amp sign to this:
& without turning on the html? ;) |
you mean replacing a & with &?
just use a str_replace after the bbcode parser :) |
PHP Code:
|
Thanks Stefan and Dean. ;)
Are there other codes I'm going to have to parse like this or will the parse_bbcode2 cover all of them other than the & sign? |
All times are GMT. The time now is 03:43 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|