vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   custom bbcode with ' or " in param (https://vborg.vbsupport.ru/showthread.php?t=194298)

matkus 10-22-2008 08:23 PM

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?

Marco van Herwaarden 10-23-2008 09:24 AM

What are the values you entered when creating this bb-code?

matkus 10-23-2008 01:52 PM

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.

Marco van Herwaarden 10-23-2008 03:04 PM

Try escaping them with a \.

matkus 10-23-2008 04:28 PM

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.

Marco van Herwaarden 10-24-2008 08:51 AM

You should escape the replacement text, not ask your users to escape strings.

matkus 10-24-2008 09:32 AM

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.

Marco van Herwaarden 10-28-2008 02:04 PM

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>

matkus 10-28-2008 03:40 PM

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.

Marco van Herwaarden 10-30-2008 08:47 AM

Please post a screen shot of this BB-Code setting page.


All times are GMT. The time now is 07:12 AM.

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.01152 seconds
  • Memory Usage 1,727KB
  • 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_code_printable
  • (2)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete