vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Create a anchor (https://vborg.vbsupport.ru/showthread.php?t=242027)

derdiedastim 05-07-2010 11:58 AM

Create a anchor
 
Hi,
it is possible to create an bbcode for anchor in vB 4?

In vB 3 I create an bbcode like this:
HTML Code:

<a href="#{option}">{param}</a>
But this doesn't work with vB 4. I think it is because of the "base"-tag in the source-Code.

Any ideas? Hacks/Mods?

mariobkk 05-28-2010 02:33 AM

I try to create anchors as well, but it doesn't work. When clicking on the anchor link I get redirected to the starting page of CMS, but not the anchor point within the post.

I created custom BB Codes as follows already, but it doesn't work:

Title: Anchor link
Tag: jumpto
Replacement: <a href="#{option}">{param}</a>
Example: [jumpto=aname]This takes you to a new location within a post[/jumpto]
Description: The [jumpto] tag allows you to jump to another location within a post, usually used for long posts with headings and/or sections of interest. This tag <b>must</b> be used in conjunction with the [aname] tag. One is not functional without the other.
Use {option}: Yes
Click Save

Title: Named anchor link
Tag: aname
Replacement: <a name="{option}">{param}</a>
Example: [aname=aname]This is where you jump to[/aname]
Description: The [aname] tag is used in conjunction with the <a href="#jumpto">[jumpto]</a> tag. One is not functional without the other.
Use {option}: Yes
Click Save

Any help would be highly appreciated.

Thank you

scarex 01-14-2011 07:38 PM

Did anyone find a solution to this problem?

Digital Jedi 01-14-2011 08:16 PM

Quote:

Originally Posted by derdiedastim (Post 2033082)
Hi,
it is possible to create an bbcode for anchor in vB 4?

In vB 3 I create an bbcode like this:
HTML Code:

<a href="#{option}">{param}</a>
But this doesn't work with vB 4. I think it is because of the "base"-tag in the source-Code.

This is not an actual anchor. This will create a link to an anchor, and only within the same page. Look at your herf attribute. If you don't put anything but #{option} then it's just going to look for the anchor name on the same page. It would need to include the URL of the page the anchor is on to do go somewhere else. Really, you don't need special BBCode for that. Just link to your anchor the way you would normally.

But like I said, you need an anchor to link to. You would need BBCode that creates the actual anchor name you want to link to, not the other way around.

Code:

<a name="{option}">{param}</a>
So you'd make a post that has the anchor in it. Let's say you named the BBcode ANCHOR.

Code:

[ANCHOR="tips"]Useful Tips[/ANCHOR]
Then when you want to link to that anchor, you just post a normal link with the anchor appended to the end of the URL.

Code:

http://www.yoursite.com/showthread.php?t=threadid123456#tips
That's it. You really only need one BBCode.


Quote:

Originally Posted by mariobkk (Post 2044400)
I try to create anchors as well, but it doesn't work. When clicking on the anchor link I get redirected to the starting page of CMS, but not the anchor point within the post.

I created custom BB Codes as follows already, but it doesn't work:

Title: Anchor link
Tag: jumpto
Replacement: <a href="#{option}">{param}</a>
Example: [jumpto=aname]This takes you to a new location within a post[/jumpto]
Description: The [jumpto] tag allows you to jump to another location within a post, usually used for long posts with headings and/or sections of interest. This tag <b>must</b> be used in conjunction with the [aname] tag. One is not functional without the other.
Use {option}: Yes
Click Save



Title: Named anchor link
Tag: aname
Replacement: <a name="{option}">{param}</a>
Example: [aname=aname]This is where you jump to[/aname]
Description: The [aname] tag is used in conjunction with the <a href="#jumpto">[jumpto]</a> tag. One is not functional without the other.
Use {option}: Yes
Click Save

Any help would be highly appreciated.

Thank you

I don't know where you got these, but you don't need the href one, the one that creates links. You can just link to the anchor normally. Just like I said above, the link you're creating would only link to an anchor if happens to be on the same page as the link.

scarex 01-16-2011 11:46 AM

Quote:

Originally Posted by Digital Jedi (Post 2149142)
This is not an actual anchor. This will create a link to an anchor, and only within the same page. Look at your herf attribute. If you don't put anything but #{option} then it's just going to look for the anchor name on the same page. It would need to include the URL of the page the anchor is on to do go somewhere else. Really, you don't need special BBCode for that. Just link to your anchor the way you would normally.

But like I said, you need an anchor to link to. You would need BBCode that creates the actual anchor name you want to link to, not the other way around.

Code:

<a name="{option}">{param}</a>
So you'd make a post that has the anchor in it. Let's say you named the BBcode ANCHOR.

Code:

[ANCHOR="tips"]Useful Tips[/ANCHOR]
Then when you want to link to that anchor, you just post a normal link with the anchor appended to the end of the URL.

Code:

http://www.yoursite.com/showthread.php?t=threadid123456#tips
That's it. You really only need one BBCode.



I don't know where you got these, but you don't need the href one, the one that creates links. You can just link to the anchor normally. Just like I said above, the link you're creating would only link to an anchor if happens to be on the same page as the link.

I Digital Jedi,
I'm using 4.01 PL2 vbulletin, and the problem in using url bbcode referring to an anchor is that the resulting hyperlink in href is something similar to http:///#<anchor-name> that's obviously doesn't work.
Instead, creating an alternative bbcode, which doesn't add "https://", the problem is that browser will redirect to site home page.

Digital Jedi 01-16-2011 02:19 PM

Quote:

Originally Posted by scarex (Post 2149972)
I Digital Jedi,
I'm using 4.01 PL2 vbulletin, and the problem in using url bbcode referring to an anchor is that the resulting hyperlink in href is something similar to http:///#<anchor-name> that's obviously doesn't work.
Instead, creating an alternative bbcode, which doesn't add "https://", the problem is that browser will redirect to site home page.

Well, obviously if the page isn't https it wont find the page. But I don't see why the other shouldn't be working. I just tried it on my 4.0.1 test board and it worked perfectly. Remember that the BBCode that you posted in the first post will not do what you wanted. You need to use the one I posted

scarex 01-16-2011 08:21 PM

Quote:

Originally Posted by Digital Jedi (Post 2150020)
Well, obviously if the page isn't https it wont find the page. But I don't see why the other shouldn't be working. I just tried it on my 4.0.1 test board and it worked perfectly. Remember that the BBCode that you posted in the first post will not do what you wanted. You need to use the one I posted

I've posted no bbcode in this thread.... anyway your bbcode works good as you are suggesting to use a normale url bbcode where you specificy the entire target url + anchor.
This suggests that I've to post the article, catch the url and then edit it adding the correct reference. Not so friendly...

Instead, I've already the anchor bbcode which place anchor target, but as I said if I use the normal url bbcode with #<anchor-name> as target, engine adds http://

Anyway, thank you :)

Digital Jedi 01-16-2011 10:41 PM

Sorry, I thought you were the OP.

So your saying, you're trying to put anchors in posts that you haven't posted yet? I presume you're only trying to link to anchors on the same page, because without the full URL, that's all you'd ever be able to do. I've can't a BBCode like that to work, but for different reasons. The one being that it always tries to use my forum URL, rather than the thread I'm on. That's normally the way it should work, though.

scarex 01-17-2011 07:01 AM

Quote:

Originally Posted by Digital Jedi (Post 2150240)
Sorry, I thought you were the OP.

So your saying, you're trying to put anchors in posts that you haven't posted yet? I presume you're only trying to link to anchors on the same page, because without the full URL, that's all you'd ever be able to do. I've can't a BBCode like that to work, but for different reasons. The one being that it always tries to use my forum URL, rather than the thread I'm on. That's normally the way it should work, though.

You're right, my problem is exactly this.

People in our staff who write CMS articles need to use anchor in the same text, in order to refer to different part of the text. I can say them to save the article, catch the url and edit it again putting the correct reference, but I'm figuring out if there was a more friendly mechanism. However, even if without "http://" in front of anchor name, browser redirect on site home page and I don't understand why....

sub_ubi 07-28-2012 12:05 AM

Fix for VB 4 is here in the original thread https://vborg.vbsupport.ru/showpost....14&postcount=3


All times are GMT. The time now is 01:22 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.01262 seconds
  • Memory Usage 1,752KB
  • 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
  • (6)bbcode_code_printable
  • (2)bbcode_html_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete