Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
[How To] Create HTML anchors using bbcode
cbiweb
Join Date: May 2004
Posts: 229

Nova Scotia, Canada
by cbiweb cbiweb is offline 20 Aug 2009
Rating: (2 votes - 5.00 average)

Overview

HTML anchors are links that allow you to jump to a specific place within a document. This is very handy for long documents that have headings or other sections of interest to the reader. Typically, the top of the document contains a set of links to each section, and you need only to click one of those links to jump to the desired location on the page.

Anchors would be just as useful in forums for those who want to make long posts, perhaps for tutorials, forum guidelines or similar types of posts. Since most, if not all vBulletin license holders do not allow HTML in their forums, here is way to create anchors using bbcode instead of HTML.


Instructions

First, you need to create two new bbcodes. Start by going to:
Admin CP -> Custom BB Codes -> Add New BB Code

Then fill in the relevant fields using these settings and parameters:

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

Create another bbcode using these settings and parameters:

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


Implementation

Wrap the [jumpto] tag around a link that will take the reader to another place within the post, as follows:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then wrap the [aname] tag around the first word or phrase of the section you want the reader to jump to:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

In the above two examples, change anchor1 to whatever name you choose for the link. (For example: if you are linking to a section called "Theory of Gravity", anchor1 could be called theory). They must both be identical in order to work correctly.


And yes, you can use these same tags for "back to top" links. Wrap the following tags around the first word of the post:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And place this one in the appropriate part of the post where a reader would click it to jump back to the top:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Views: 13018
Reply With Quote
Comments
  #2  
Old 04 Dec 2009, 07:53
lm3a.net's Avatar
lm3a.net lm3a.net is offline
 
Join Date: May 2009
thanks !!
Reply With Quote
  #3  
Old 28 Jul 2012, 02:03
sub_ubi sub_ubi is offline
 
Join Date: Dec 2004
For VB 4 on the Title: Anchor link

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

needs to be

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

rest is the same as above
Reply With Quote
  #4  
Old 25 Feb 2013, 18:55
Dorgham's Avatar
Dorgham Dorgham is offline
 
Join Date: May 2012
I am a newbie in this world
I like those bbcode
__________________
AdSense revenue sharing 100% - [ Hanan ]
News, egypt : أخبار مصر - Photo, picture : صور
Reply With Quote
  #5  
Old 26 Jan 2015, 06:17
bchertov's Avatar
bchertov bchertov is offline
 
Join Date: Dec 2004
Location: Sonoma County, CA
Real name: Barry
Originally Posted by sub_ubi View Post
For VB 4 on the Title: Anchor link

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

needs to be

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

rest is the same as above
What do you mean by {relpath} above?
__________________
Reply With Quote
  #6  
Old 15 Feb 2015, 18:49
Duke49th Duke49th is offline
 
Join Date: Sep 2014
Relpath (relative path) sets the Forum Path to the Post/Blog adress and adds the" #anchor-name" after it.

For example, the result is:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If not...you will end up on the starting page with an error...like:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Sorry for my english, hope you're getting me.

Btw...if you use the BBCode via the editor it will ask for "option"....this "option" is the anchor name or ID. You need to give it a name, otherwise it won't work.

Last edited by Duke49th; 15 Feb 2015 at 18:56.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 11:35.

Layout Options | Width: Wide Color: