Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 04-24-2009, 02:22 PM
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Location: Boston
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Modifying built in bb codes

The built in IMG bb code does not provide a means to specify the alt text string that goes with the image.

I can write an IMG bb code that works correctly to use the {option} variable to receive the alt text. It would work like: [img="Alternate text for the hovering cursor"]http://url_for_image.gif[/img].

Can I just create this bb code in custom bb codes and have it replace the built in bb code, or does that require some other hack somewhere?
Reply With Quote
  #2  
Old 04-24-2009, 08:08 PM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you create an custom IMG bbcode, as long as you set it to use the option variable it will do what is called "overloading". bbCode overloading means that you have two bbcodes with the same name, but one of them uses an option and the other doesn't. In this way, people can still use the bbCode without the option, or with it.
Reply With Quote
  #3  
Old 04-25-2009, 12:01 AM
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Location: Boston
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Jake answered this quesion on vBulletin.com about the same time as you did here.

I put in the bb code, but there is still a bit of a problem.

The parser stops when it sees the first space in the option string. Quotes of either kind, curly's, &nbsp, %20 and so forth do not help. I don't know if I want to fool with the parser, but the option token should be parsed to the closing square bracket, I believe.

Jake suggested that I ask someone here to tell me how to fix the code in the parser.
Reply With Quote
  #4  
Old 04-25-2009, 01:49 PM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You have it backwards. You should reverse it. Make the Option Code into the IMG URL and the text in the value section. This way it's just like the URL bbCode...

http://www.google.com
The All Knowing Google


[img=http://www.google.com/intl/en_ALL/images/logo.gif]Google's Logo[/img]

Can you dig it?
Reply With Quote
  #5  
Old 04-25-2009, 03:00 PM
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Location: Boston
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are right that the change would work. However, it would then be very different from the native IMG code. Maybe that doesn't really matter.

I was thinking of it as a modification of the existing code. I could just make up a new name entirely and avoid any confusion.
Reply With Quote
  #6  
Old 04-25-2009, 07:20 PM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tommythejoat View Post
You are right that the change would work. However, it would then be very different from the native IMG code. Maybe that doesn't really matter.

I was thinking of it as a modification of the existing code. I could just make up a new name entirely and avoid any confusion.
I think you won't have that problem. See, by doing it that way - you're keeping with the standards set by the URL bbCode. This makes more sense to a lot of people since you would be treating them both the same way.

If you really wanted to modify the way the IMG bbCode is handled, you can try using a plugin... But it would be overly complicated and unnecessary.
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:50 PM.


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.04979 seconds
  • Memory Usage 2,202KB
  • 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_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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