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 01-22-2009, 03:35 AM
Forgott3n Forgott3n is offline
 
Join Date: Oct 2007
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Hand coding custom BB code

Hello,

I need to create a clone of [code] by editing the vbulletin files.

We are currently trying to create custom BB code that will parse its contents with white-spacing and fixed width (similar to [code] tag). This is how we do it using the admincp custom bb code menu:

<pre style="font-family:"Courier New", Courier, monospace !important;"> Your tabs here </pre>

However, the WYSIWYG editor still adds <br> tags to every new line, resulting in twice as many new lines as we need:

<pre style="font-family:"Courier New", Courier, monospace !important;">

Lorum ipsum<br>
dolor ist

</pre>

shows as:

Lorum ipsum

dolor ist

So how do I "carbon-copy" [code] but change the name to [chords] and change it's div width?

Thanks!

[EDIT] Just to add, I know next to nothing about how vBulletin uses "hooks" and "callbacks". I know PHP 4, but not too familiar with PHP 5's OOP. I am currently looking at

https://vborg.vbsupport.ru/showthread.php?t=200769

for help.
Reply With Quote
  #2  
Old 01-22-2009, 01:39 PM
Vaupell's Avatar
Vaupell Vaupell is offline
 
Join Date: Apr 2008
Location: Esbjerg, Denmark
Posts: 1,036
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well if <br> dosent work for me i would usually try something entirely different..
<p></p> perhaps.. <br /> same as <br> but for sometimes it changes something.

just a few suggestions. wouldnt know, just experiment.
Reply With Quote
  #3  
Old 01-22-2009, 02:02 PM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wouldn't this as a custom BBCode essential do the same thing:

Code:
<div style="white-space: pre;width:300px; overflow:scroll"><code>{param}</code></div>
Reply With Quote
  #4  
Old 01-22-2009, 02:35 PM
Forgott3n Forgott3n is offline
 
Join Date: Oct 2007
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Digital Jedi View Post
Wouldn't this as a custom BBCode essential do the same thing:

Code:
<div style="white-space: pre;width:300px; overflow:scroll"><code>{param}</code></div>
Unfortunately not, vBulletin still adds a <br> for every new line. As a result the browser makes a newline for every <br> AND every newline in <code>

This is why I need to hard code it in vBulletin so I can override the nl2br part of the bbcode
Reply With Quote
  #5  
Old 01-22-2009, 02:39 PM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So your saying that it converts the literal posting of a <br /> tag into an actual carriage return?
Reply With Quote
  #6  
Old 01-22-2009, 03:00 PM
Forgott3n Forgott3n is offline
 
Join Date: Oct 2007
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Digital Jedi View Post
So your saying that it converts the literal posting of a <br /> tag into an actual carriage return?
I'm saying that it converts the literal posting of a new line into a new line AND a <br /> tag. This means I get an extra new line (twice as many) for every time I press enter.

So in the WYSIWYG editor:

Code:
Lorum ipsum
dolor ist
The result shows up like on the page:

Code:
Lorum ipsum

dolor ist
And the source code shows:

HTML Code:
<pre>
Lorum ipmsum<br />
dolor ist
</pre>
<pre> tags will literally take new lines in source and parse them, as well as <br /> tags. Resulting in double spacing.
Reply With Quote
  #7  
Old 01-22-2009, 03:13 PM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So if I'm understanding your right, you don't mind the breaking space, as long as it doesn't double it up.

If that's the case, I think pre, whether you use CSS or the HTML tag, automatically double spaces lines. I tried this and got the results I believe your looking for:

Code:
<div style="white-space:nowrap; width:300px; overflow:scroll;"><code>{param}</code></div>
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 02:42 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.08993 seconds
  • Memory Usage 2,224KB
  • 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
  • (5)bbcode_code
  • (1)bbcode_html
  • (2)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