The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Line Break not showing in custom field
I have a custom template with the code below displaying a users field. It is a multi-line text field. Even though I include line breaks, it does not parse them.
Code:
$userinfo[field31] |
#3
|
||||
|
||||
I understand how to use nl2br, but how would you use the BBCode Parser for the following code instead of nl2br?
Code:
$thequote = nl2br("\n" . $quote[quote] . "\n\n"); $thequoter = nl2br("-- " . $quote[name] . "\n\n"); |
#4
|
|||
|
|||
@ Boofo: In general... Parse BBCode (in 3.5)
See the [minicode]$do_nl2br[/minicode] variable. (Not sure how your specific example differs.) |
#5
|
||||
|
||||
OK, thanks for that. Since the code I needed it for was only 2 lines, I decided to go the nl2br route instead of the BBCode Parser. Originally, I used <br /> tags in the template but didn't like the way it looked.
|
#6
|
||||
|
||||
Please bare with me, as I'm slightly confused on how to implement the code.
I used the following tutorial to create a new template called memberinfo_userdetails: https://vborg.vbsupport.ru/showthrea...ghlight=plugin The contents of this template are numerous custom user fields, including $userinfo[field31] which is the one I need parsed. I have 2 plugins: Cached - memberinfo_userdetails Code:
$globaltemplates = array_merge($globaltemplates, array('memberinfo_userdetails')); memberinfo_userdetails Code:
eval('$memberinfo_userdetails = "' . fetch_template('memberinfo_userdetails') . '";'); --------------- Added [DATE]1209429644[/DATE] at [TIME]1209429644[/TIME] --------------- ====UPDATE==== I used your file Boofo: https://vborg.vbsupport.ru/showpost....6&postcount=31 It does parse the line breaks correctly, however it does not parse the quotes, it simply shows " instead. |
#7
|
||||
|
||||
I will look at it and see if I can't update it.
|
#8
|
||||
|
||||
I've tried a few things such as Replacement Variables, but they have no effect.
I've tried some php code, here is what seems to be valid, but takes no effect either: Code:
require_once(DIR . '/includes/class_bbcode.php'); $parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $parsed_text = $parser->do_parse($text, $do_html, $do_smilies, $do_bbcode, $do_imgcode, $do_nl2br, $cachable); $parsed_text = preg_replace('/"/', '"', $parsed_text); $parsed_text = strtr($parsed_text, array('"' => '"')); $parsed_text = str_replace('"', '"', $parsed_text); $parsed_text = htmlspecialchars($parsed_text); ===UDATE=== I feel like an idiot... It works fine now. I had the same profile field parsed twice. And it parsed the first one without any HTML and so forth, rather than the second one asking to be parsed correctly. In any case, all is well. |
#9
|
||||
|
||||
Can you post the exact code you got to work? And did you add it to my product?
|
#10
|
||||
|
||||
Here is all the information that you need: (most if is based on your plugin already)
I have a custom template which appears in inside my profile page, which includes the following code: $userinfo[field20] and $userinfo[field31] (and a few others, but for the sake of the example I will include these two) Plugin Name: Init BBCode-Parser Location: member_start Code:
require_once(DIR . '/includes/class_bbcode.php'); $parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); Location: member_complete Code:
$userinfo['field20'] = $parser->do_parse($userinfo['field20'], 1, 0, 1, 0, 1, 0); $userinfo['field31'] = $parser->do_parse($userinfo['field31'], 1, 0, 1, 0, 1, 0); The numbers refer to different things, here they are in order: $do_html, $do_smilies, $do_bbcode, $do_imgcode, $do_nl2br, $cachable |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|