PDA

View Full Version : Help needed using bbcode_parser on non forum text


richy96
06-05-2011, 11:31 AM
Hi

I'm using the following code to parse forum text.

This is in a VBa CMPS module I have written that displays from selected forum posts in a list of 'Whats Occurring' on my site home page

require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(),true);


$occuredUser[$i]['announcetxt'] = $bbcode_parser->parse($occuredUser[$i]['announcetxt'], $forum['nonforum'], true);



It works in as much as it parses the BB code like text colour, bold, italic etc

However it does not Parse smilies (they just don't show up when the parsed text is output)

Smilies are enabled on my site and work in forums, PMs etc

What am I doing wrong?

Cheers
Rich

--------------- Added 1307283641 at 1307283641 ---------------

Had a play a bit further but still can't sort this myself

In Vbulletin OPtions -> BB Code Settings
Allow Smilies in Non Forum Specific Areas = Yes

I also tried the following as it seemed promising...

$occuredUser[$i]['announcetxt'] = $bbcode_parser->parse($occuredUser[$i]['announcetxt'], 'nonforum', true);
$occuredUser[$i]['announcetxt'] = $bbcode_parser->parse_smilies($occuredUser[$i]['announcetxt'], true);

Got me nowhere. :eek:

Parsed text OK, no smilies still - and a headache coming on :confused:

BirdOPrey5
06-05-2011, 01:35 PM
It's a dirty solution but I have come across this issue myself...

change:

$occuredUser[$i]['announcetxt'] = $bbcode_parser->parse($occuredUser[$i]['announcetxt'], $forum['nonforum'], true);



Chnage $forum['nonforum'] to the actual forumid of a working forum on your site... so change it to 2 or something. It will then use the permissions for that forum which should tell it to parse smilies.

richy96
06-05-2011, 06:04 PM
Tried what you said Joe and had no joy with that. I banged my head against this for another hour

I even in desparastion tried a temporary edit of class_bbcode.php on my test site, adding another case of 'test' to the Switch statement where I declared the $dohtml, $dobbcode, $doimagecode, $dosmilies all to = true..... and I still got no smilies :eek:

Then just as I was going to post back here with my woes it dawned on me what is going on and I looked at the page html source

bbcode parser is indeed parsing the damn smilies (and possibly was all along) the real problem is it produces html like

<img src="images/smilies/new/googled.gif ..... />

And that ain't gonna work on my homepage as from my VBa module I am executing in http://swapscene.com and not http://swapscene.com/forums so of course the path is wrong and nothing shows up!!!

Now how the hell do I get myself out of that one?

Rich

BirdOPrey5
06-05-2011, 10:17 PM
Tried what you said Joe and had no joy with that. I banged my head against this for another hour

I even in desparastion tried a temporary edit of class_bbcode.php on my test site, adding another case of 'test' to the Switch statement where I declared the $dohtml, $dobbcode, $doimagecode, $dosmilies all to = true..... and I still got no smilies :eek:

Then just as I was going to post back here with my woes it dawned on me what is going on and I looked at the page html source

bbcode parser is indeed parsing the damn smilies (and possibly was all along) the real problem is it produces html like

<img src="images/smilies/new/googled.gif ..... />

And that ain't gonna work on my homepage as from my VBa module I am executing in http://swapscene.com and not http://swapscene.com/forums so of course the path is wrong and nothing shows up!!!

Now how the hell do I get myself out of that one?

Rich

Ahh.. that's what happens when you use a browser that doesn't show broken image place holders.

Again I was in a similar situation. What I ended up doing was editing my smileys to change their paths from "image/smilies/happy.gif" to "/forums/images/smilies/happy.gif"

This will insure they display properly on all pages they are called.

I was also told instead of editing every single smiley I could have used the "replacement variable manager" in the styles to replace images/smilies with /forums/images/smilies and get the same results.

richy96
06-06-2011, 08:12 AM
OK thanks once again Joe I'll give that a go

Sounds better than my idea overnight to search the parsed string and replace the offending links!

Yes agreed the browser not showing broken image place holders did not help, but then again I put it down to my own inexperience not thinkg to look at the page source! Only been programming php for less than a year so another lesson learned the hard way!