The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Thread preview formatting
Hopefully this is an easy question. I've hunted around here and couldn't find a solution.
I'm using vbulletin 3.8.7. and vBadvanced 3.2.2. I've set up an RSS "megafeed" page which uses the vBadvanced "latest threads" module to combine a dozen or so RSS feeds into one page. You can see it here. I've moved the thread preview text so it appears automatically after the title, rather than only on mouseover. So far so good; all working fine. My problem, as you can see from the linked page, is the formatting of the thread preview text. If there is an image, or some slightly dodgy html in the original RSS feed, you see the image URL or some html tags, which is ugly as heck. For example, you can see things like: Code:
Conquest Day Monday, April 2, 2012 http://www.enworld.org/image/content/PathfinderSociety/PZO9226-Nex_180.jpeg Illustration by Dave Rapoza I almost lined this holiday boon up perfectly with its in-game date and real-world date. When I realized it was my 6-month anniversary (wow, time... Code:
Unless you come here at least a few times a month, you will not likely notice it, but I have made some changes here on site last night and today. I wanted to take some time and explain why they (…)</p>Read the rest of this entry ? More... Any ideas? |
#2
|
||||
|
||||
Basically you'd need to make a plugin on some hook that you can intercept the preview text and clean it with various php functions.
You can probably remove most of the HTML tags like <p> , </p>, <br />, etc... using the str_ireplace function. Code:
$clean_array = array ('<p>', '</p>', '<br />', '<h1>', '</h1>'); $text = str_ireplace($clean_array, '', $text); However you'd still be stuck with images... For those you'd probably need to make a regex to find patterns and remove them with preg_replace. But since this stuff is all happening in a VBAdvanced product I have no idea what the actual hook you need to use is. |
#3
|
|||
|
|||
Thanks.
Sounds like it's a harder job than I thought it would be. |
#4
|
|||
|
|||
There is something used in the RSS feed (external.php) among other places. It looks like this:
Code:
require_once(DIR . '/includes/class_bbcode_alt.php'); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list($vbulletin->options['bburl'] . '/')); $plaintext = $plaintext_parser->parse($message, $forumid); (I copied this from external.php and modified it slightly, so I don't know why it uses $vbulletin->options['bburl'] or what the $forumid is used for). |
#5
|
||||
|
||||
I found out there is also a strip_tags() php function that will remove HTML taga, don't need to worry about str_ireplace().
|
#6
|
|||
|
|||
Quote:
It would certainly help! Wouldn't solve all the problems, but would help with some of 'em! |
#7
|
||||
|
||||
Like I said before it;s vbadvanced so I have no clue what hook you'd need, you can probably ask over at the vbadvanced forums. It may take a few days but Brian will usually answer in my experience.
Once you find the hook and the variable that holds the text of the preview, for example let's say it is $text, then you simply make a new plugin (ACP -> Plugin Manager -> Add new plugin) on the specific hook with this code: PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|