vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Help needed using bbcode_parser on non forum text (https://vborg.vbsupport.ru/showthread.php?t=264750)

richy96 06-05-2011 11:31 AM

Help needed using bbcode_parser on non forum text
 
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

Code:

        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 [DATE]1307283641[/DATE] at [TIME]1307283641[/TIME] ---------------

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...
Code:

                        $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:
Code:

        $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

Quote:

Originally Posted by richy96 (Post 2203933)
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!


All times are GMT. The time now is 08:17 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
  • Page Generation 0.01069 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete