Is there a way for a simple html/php page to use SMF to parse a variable for BBC

Started by Jacen, June 24, 2008, 06:22:42 PM

Previous topic - Next topic

Jacen

Okay, what I want is say I have a PHP page like:


<?
$var = "[b]Test[/b]";

echo $var;
?>


What I'd like to do is simply parse the $var for BBC using SMF's parser... Is this possible?
"I've always found that sticking your fingers in your ears and humming loudly solves a whole slew of problems."

Kindred

possible... but complicated.

Someone did something similar for the discussbot for Joomla/mambo
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

karlbenson

If your using ssi, it should be easy.

Once you've got ssi, you can just use smf's parse_bbc(); function to parse it.

http://support.simplemachines.org/function_db/index.php?action=view_function;id=242

So you would use something like
$var = parse_bbc($var, true, '');
Change the true to false if you don't want smileys parsed. Just bbcode.

Jacen

Quote from: karlbenson on June 24, 2008, 06:39:23 PM
If your using ssi, it should be easy.

Once you've got ssi, you can just use smf's parse_bbc(); function to parse it.

http://support.simplemachines.org/function_db/index.php?action=view_function;id=242

So you would use something like
$var = parse_bbc($var, true, '');
Change the true to false if you don't want smileys parsed. Just bbcode.

Thanks, this looks exactly like what I want.

Stupid question.. does it have to be a variable or can I use the include function to get it to parse and echo an entire .txt file?
"I've always found that sticking your fingers in your ears and humming loudly solves a whole slew of problems."

Nathaniel

It has to be a variable, but you should be able to open the file and pass it to the function as a string anyway.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Jacen

"I've always found that sticking your fingers in your ears and humming loudly solves a whole slew of problems."

Advertisement: