Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 08-27-2006, 11:19 AM
Aurons Ghost Aurons Ghost is offline
 
Join Date: Jul 2006
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Multiple options in custom bbcode

I have a story archive associated with my site and I am trying to set up some bbcode that can easily link to those stories and to chapters within those stories.

story urls are http://stories.mysite.net/viewstory.php?sid=Story ID
and chapter urls are http://stories.mysite.net/viewstory.php?sid=Story ID&chapter=Chapter number

I know I can get the first to work simply with:
Code:
[story={option}]{param}[/story]
<a href="http://stories.mysite.net/viewstory.php?sid={option}">{param}</a>
but I don't know how to do the second, or even if it's possible. I think it should be like this:
Code:
[chapter={option1},{option2}]{param}[/chapter]
<a href="http://stories.mysite.net/viewstory.php?sid={option1}&chapter={option2}">{param}</a>
I would guess I need to make a plugin for this to work, how would I go about doing this, if it's possible at all?

(I'm on 3.5.4 if that's any help)
Reply With Quote
  #2  
Old 08-27-2006, 03:49 PM
Renmiri Renmiri is offline
 
Join Date: Jul 2006
Location: Chicago, USA
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is possible but...

From class_bbcode.php:

Code:
	/**
	* Allows extension of the class functionality at run time by calling an
	* external function. To use this, your tag must have a callback of
	* 'handle_external' and define an additional 'external_callback' entry.
	* Your function will receive 3 parameters:
	*	A reference to this BB code parser
	*	The value for the tag
	*	The option for the tag
	* Ensure that you accept at least the first parameter by reference!
	*
	* @param	string	Value for the tag
	* @param	string	Option for the tag (if it has one)
	*
	* @return	string	HTML representation of the tag
	*/
	function handle_external($value, $option = null)....
So you would have to have a bbcode that called on handle_external($value,$option) and split it

Something like that
Code:
<a href="http://stories.mysite.net/viewstory.php?sid=explode_option({option})[0]&chapter=explode_option({option})[1]">{param}</a>
where explode_option($value) was your function..

Optionally, the bbcode parser does parse javascript so you could make do with a javascript function that returned the proper URL

kk, found a mod that taught me how to call "handle external" procedures for bbcodes.
vB Code [table]

Using the xml file it is pretty straight forward. All you need is to import the plugin and create a bbcode for [chapter] with a blank replacement string
Attached Files
File Type: txt storytag.xml.txt (1.4 KB, 17 views)
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 04:46 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.03542 seconds
  • Memory Usage 2,181KB
  • Queries Executed 12 (?)
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
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (1)postbit_attachment
  • (2)postbit_onlinestatus
  • (2)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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete