Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2011, 11:31 AM
richy96's Avatar
richy96 richy96 is offline
 
Join Date: Apr 2008
Location: England
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.

Parsed text OK, no smilies still - and a headache coming on
Reply With Quote
  #2  
Old 06-05-2011, 01:35 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 06-05-2011, 06:04 PM
richy96's Avatar
richy96 richy96 is offline
 
Join Date: Apr 2008
Location: England
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

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
Reply With Quote
  #4  
Old 06-05-2011, 10:17 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by richy96 View Post
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

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.
Reply With Quote
  #5  
Old 06-06-2011, 08:12 AM
richy96's Avatar
richy96 richy96 is offline
 
Join Date: Apr 2008
Location: England
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:40 PM.


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.04139 seconds
  • Memory Usage 2,208KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete