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 07-19-2006, 06:43 AM
NeilFawcett NeilFawcett is offline
 
Join Date: Mar 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default BBCodes get converted except for QUOTE and CODE - Why? Please help!

I'm trying to use a plugin which allows (amongst other things) to treat a forum as a "new forum". The plugin then simply allows the posts to be listed as "news".

HOWEVER, if the posts use any QUOTE or CODE tags, the text within these tags is completely lost and does not get returned from the code.

IMG tags etc are processed fine for example, just not QUOTE or CODE ones. So I'm a little baffled as to why no text is returned at all for these tags (even if wasn't correctly formatted).

Is anyone able to shed any light on the reason why the text (on these tags) might being going AWOL? Not being able to use QUOTE is a big loss!


The thread about the plugin is [url]https://vborg.vbsupport.ru/showthread.php?t=83005[url] - I posted this very question there (along with others) but no reply/help has been forthcoming
Reply With Quote
  #2  
Old 07-19-2006, 10:40 AM
louis_chypher's Avatar
louis_chypher louis_chypher is offline
 
Join Date: Mar 2006
Location: Boise, Idaho
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

look in yourforum/includes/class_bbcode.php around line 126 and around line 141 for information on how those two bbcode tags work.
Reply With Quote
  #3  
Old 07-19-2006, 11:18 AM
NeilFawcett NeilFawcett is offline
 
Join Date: Mar 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by louis_chypher
look in yourforum/includes/class_bbcode.php around line 126 and around line 141 for information on how those two bbcode tags work.
OK... Looks like were onto similar things...

A call to that function (vB_BBCodeParser) already exists.... Is it maybe simply not calling it correctly for the post's text to deal with QUOTE and CODE tags?

Can you see it being used to process the text into "post"?

Code:
	function output_News($a = 5,$f = ""){
	global $db, $Data, $vbulletin;

	// Define amount to show
	$Amount = ($a)? intval($a) : 5;

	// Define Forum To Pull From
	$Forum = ($f)? intval($f): '';

		if(!$Forum){
		RunError("No specified forum to pull news from.");
		}	

	// Load Template
	$Template = LoadTemplate("news.html");

	// Collect Data
	$NewestNews = $db->query("
			select t.*,p.pagetext
			from ".TABLE_PREFIX."thread t
			left join ".TABLE_PREFIX."post p on(p.postid=t.firstpostid)
			where t.forumid = $Forum
			order by dateline desc
			limit 0,$Amount");

	$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());

		while($News = $db->fetch_array($NewestNews)){

		$neils_date = date( "l j", $News['dateline']) . "-" . substr(date( "F", $News['dateline']),0,3) .  "-" . date( "Y", $News['dateline']);

		$Data .= ParseTemplate($Template,
			array(
				'threadid'     => $News['threadid'],
				'threadname'   => $News['title'],
				'postuserid'   => $News['postuserid'],
				'postusername' => $News['postusername'],
				'post'         => $bbcode_parser->parse(unhtmlspecialchars($News['pagetext']), $f),
				'comments'     => vb_number_format($News['replycount']),
				'postdate' => $neils_date,
			)
		);
	}
I believe $f (second parameter) being used in the call is the forum number? That's a bit odd isn't it?

Also in other examples I've seen do_parse is referenced, not "parse"?

Note: Other tags are being converted (eg: IMG and URL)
Reply With Quote
  #4  
Old 07-20-2006, 06:16 PM
NeilFawcett NeilFawcett is offline
 
Join Date: Mar 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I do:-
$neils_text = $bbcode_parser->do_parse($News['pagetext'], 0, true, false, true, true, 0);
No BBCode is transformed!

And if I do:-
$neils_text = $bbcode_parser->do_parse($News['pagetext'], 0, true, true, true, true, 0);
All BBCode is transformed except for QUOTE and CODE... What is so special about QUOTE and CODE?

HELP!!!!
Reply With Quote
  #5  
Old 01-04-2009, 01:36 AM
dc3dreamer dc3dreamer is offline
 
Join Date: Oct 2005
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Years later, I am having the same problem, exactly! I'm working on Cyrcix's Email Integration.

$html = $parser->do_parse($bbcode, true, true, true, true, true, 0);

Both [code] and [quote] blocks result in nothing in the HTML output. I have traced it through class_bbcode.php to the point where it fetches the conversion templates for bbCodes. Using a tracing file and fwrite() statements, I have determined that in the function handle_bbcode_code(), the call to fetch_template('bbcode_code') is returning nothing!

Here's the corker: Out of the 20+ tests I did, one time it worked! I then ran the test again without changing anything at all and it failed as before. Throughout, I didn't change anything in the code except to add fopen(), fwrite(), and fclose() to do the tracing (I'm working on a remotely hosted system, ugh).

The difference is that this code is running as a vBulletin Scheduled Task (cron). The same code in another area of the plugin that runs in the normal VB posting context works reliably.

Can anyone give me a hint? The fact that it works once in a blue moon and fails otherwise, with no code changes, has me baffled.
Reply With Quote
  #6  
Old 01-06-2009, 09:04 AM
dc3dreamer dc3dreamer is offline
 
Join Date: Oct 2005
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is a crazy problem. I "solved" it by hand-converting the quote and code blocks with preg_replace(). I believe the template cache needs to be loaded in the cron task explicitly. The reason it worked once in a blue moon is that it just happened to run while a forum page was being rendered for some user and the template cache happened to have stuff in it. That's just a theory though!
Reply With Quote
  #7  
Old 01-06-2009, 09:44 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When ran from the Scheduled Task, you must ensure that al needed template groups have been loaded.

That it might work once and not again might be caused by the cache. Either (temporary) disable the post cache or clear the cache table.
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 09:16 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04126 seconds
  • Memory Usage 2,222KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_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