Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-22-2008, 08:23 PM
matkus matkus is offline
 
Join Date: Jan 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default custom bbcode with ' or " in param

Hello.

I have some problem. I want to create custom bbcode, that will link to something. Lets say user types
[mybb]something[/mybb]
and it is converted to
<a href="http://example.com/?param=something">something</a>
Everything works fine if i simply add custom bb code, but when {param} have ' or ", because it closes href in link and it does not work anymore as expected. Is there any way to fix this without modding? Or if it need mod, can anyone give me small example or link to some mod, that i could use as example to create my own?
Reply With Quote
  #2  
Old 10-23-2008, 09:24 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What are the values you entered when creating this bb-code?
Reply With Quote
  #3  
Old 10-23-2008, 01:52 PM
matkus matkus is offline
 
Join Date: Jan 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

here's the exactly replacement i have for my bbcode
Code:
<a href="http://tibiaspy.com/index2.php?p=item&amp;itemname={param}" onmouseover="ajax_showTooltip('ajax_item.php?itemname={param} ',this);return false" onmouseout="ajax_hideTooltip()">{param}</a>
Everytjing works fine until I use ' or " as {param}, because it closes href or onmouseover tags.
thise ajax_xxxx functions are JS scripts i've found somewhere.

Can i in easy way replace ' and " to something else? it can be anyrhing, i'll parse it on my script as needed.
Reply With Quote
  #4  
Old 10-23-2008, 03:04 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try escaping them with a \.
Reply With Quote
  #5  
Old 10-23-2008, 04:28 PM
matkus matkus is offline
 
Join Date: Jan 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure, but i can't tell my users to escape parameters. Some people will not understand it or simply will not remember about it, and 95% will not read my instruction :P. I have to do this while converting bbcode to link, and i don't know how to do it.
Reply With Quote
  #6  
Old 10-24-2008, 08:51 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should escape the replacement text, not ask your users to escape strings.
Reply With Quote
  #7  
Old 10-24-2008, 09:32 AM
matkus matkus is offline
 
Join Date: Jan 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i know that, and i'm asking from first post how to do it.
I'm not vB guru, i don't know how to make vB mods, and also i don't know Javascript, so I can't make script to do this. I know PHP, but i can't use PHP in BBCode replacement, or at least i don't know how to do this.
Reply With Quote
  #8  
Old 10-28-2008, 02:04 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try changing your replacement code to:


HTML Code:
<a href=\"http://tibiaspy.com/index2.php?p=item&amp;itemname={param}\" onmouseover=\"ajax_showTooltip(\'ajax_item.php?itemname={param} \',this);return false\" onmouseout=\"ajax_hideTooltip()\">{param}</a>
Reply With Quote
  #9  
Old 10-28-2008, 03:40 PM
matkus matkus is offline
 
Join Date: Jan 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've copied Your code, but now forum does not convert it at all, like it didn't know that bbcode.
And when I use my bbcode, as [item]Ravager's Axe[/item] it is converted to
HTML Code:
<a href="http://tibiaspy.com/index2.php?p=item&amp;itemname=Ravager%27s%20Axe" onmouseover="ajax_showTooltip('ajax_item.php?itemname=Ravager's Axe ',this);return false" onmouseout="ajax_hideTooltip()">Ravager's Axe</a>
as you can see, ' inside ajax_showTooltip closes parameter of that function, and so function does not work correctly.
Reply With Quote
  #10  
Old 10-30-2008, 08:47 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please post a screen shot of this BB-Code setting page.
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 12:12 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.04391 seconds
  • Memory Usage 2,249KB
  • Queries Executed 13 (?)
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_code
  • (2)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete