News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Removing Most BBCode For Frontpage Display

Started by jadz, December 15, 2005, 08:03:32 PM

Previous topic - Next topic

jadz

I want to have a front page display where most bbcode entries are removed (for a front page that shows recent threads and their most recent post). What is my best bet for doing this?

What I have started to do is to copy the parsecode(&$message) function into a new custom function frontPageParseCode(&$message). Then I modified doUBBC to look like doUBBC($message, $enableSmileys = true, $frontpage = false) which allows me to switch between the two parsers.

I can now edit the regular expressions in frontPageParseCode to remove stuff like the quote tags and img tags etc.

Does this make sense to do the parsing this way?
YaBB -> YaBBSE -> SMF

Compuart

#1
The easiest way would be to parse it at first and then remove the HTML from the parsed content.

Try something like this:
<?php
censorText
($input_text);
$input_text doUBBC($input_textfalse);
$clean_msg strip_tags(str_replace(array('<div class="quote">''<div class="code">''</div>'), '<br />'$input_text'<br>');
?>
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

jadz

I was hoping to save the processing time by not doing that.  My new  frontPageParseCode function seems to be doing the job nicely.
YaBB -> YaBBSE -> SMF

Advertisement: