vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Modifying built in bb codes (https://vborg.vbsupport.ru/showthread.php?t=212079)

tommythejoat 04-24-2009 01:22 PM

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?

TigerC10 04-24-2009 07:08 PM

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.

tommythejoat 04-24-2009 11:01 PM

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.

TigerC10 04-25-2009 12:49 PM

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

https://vborg.vbsupport.ru/external/2009/04/7.gif
[img=http://www.google.com/intl/en_ALL/images/logo.gif]Google's Logo[/img]

Can you dig it?

tommythejoat 04-25-2009 02:00 PM

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.

TigerC10 04-25-2009 06:20 PM

Quote:

Originally Posted by tommythejoat (Post 1798791)
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.


All times are GMT. The time now is 11:19 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.02018 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete