Creating links to locations on a page BBcode

Post Reply
Steve
Posts: 62
Joined: Sun Oct 01, 2017 3:08 pm

Creating links to locations on a page BBcode

Post by Steve » Sat Dec 23, 2017 7:36 pm

Links allow users to move to specific places in a post. They can be used to create menus or link to a location on a different page. For example if you select and copy the code below and paste in a new browser window, you will return to the bottom of this page. Using the TARGET code, you can create links on another website that point to page locations on your website.

Code: Select all

https://skdavis.net/viewtopic.php?f=13&t=43#endofpage
To use links, on a page, create two BBcodes. The first code is GOTO which is the link a user selects to move to the target. The target must exist on the page or the link does nothing. GOTO can only be used on the page where it resides. The second code is the TARGET which is placed where you want the user to land. The target is not shown on the page but is visible when you edit the post. You can put a target anywhere in a post. You can use a TARGET without GOTO but you cannot use GOTO without a TARGET.

For example clicking here moves to the bottom of this page because a valid target exists. While clicking this link does nothing because there is no target.

Names are case sensitive and the name used for SIMPLETEXT1 in GOTO must be identical to the name used for SIMPLETEXT in TARGET. If they are different the code does not work. SIMPLETEXT2 is displayed as the link the user selects to move to the target. Since SIMPLETEXT2 is informational, it can contain multiple words and spaces or a complete sentence. Multiple links can be used in the same post as long as each GOTO/TARGET set has a unique name.

First create the GOTO code.

BBcode Usage:

Code: Select all

[Goto={SIMPLETEXT1}]{SIMPLETEXT2}[/Goto]
HTML Replacement:

Code: Select all

<a href="#{SIMPLETEXT1}">{SIMPLETEXT2}</a>
Help line:

Code: Select all

Goto [goto=Target Name]Target Link text[/goto]
Second create the TARGET code.

BBcode Usage:

Code: Select all

[Target]{SIMPLETEXT}[/Target]
HTML Replacement:

Code: Select all

<a name="{SIMPLETEXT}"></a>
Help line:

Code: Select all

[Target]Name of the Target[/Target]
Place the target on or above the sentence where you want the user to land. Remember if you use multiple links on a page, make sure each goto/target set has a unique name.


Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec lacus eu odio posuere pellentesque ut at magna. Aliquam dapibus, ex non accumsan iaculis, lorem eros finibus justo, ac congue elit nisl ut leo. Vivamus aliquam nisl dui, ac tincidunt velit vestibulum vel. Nunc elit neque, interdum ut nisl id, convallis hendrerit massa. Integer elementum interdum arcu ut luctus. Donec in magna et libero tristique sollicitudin. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;

Morbi faucibus, mauris et cursus scelerisque, diam leo lobortis nulla, at egestas nibh neque vitae magna. Proin egestas est id arcu imperdiet efficitur. Morbi ut justo vulputate, pharetra mi nec, tristique dolor. Aenean sed erat nisl. Maecenas sed eros libero. Proin sit amet risus in urna efficitur iaculis. Vestibulum fermentum neque felis, non ullamcorper est bibendum nec. Vestibulum tristique ullamcorper est in aliquam. Sed efficitur ornare neque sit amet vestibulum. In faucibus turpis non lobortis pharetra. Mauris viverra nulla ut quam tempor, eget condimentum lacus lacinia. Suspendisse potenti. Suspendisse mollis odio a tellus mollis, ac eleifend sem tincidunt.

Praesent egestas at sem vel posuere. Vivamus eu rutrum dolor. Maecenas diam orci, blandit nec turpis a, consectetur pulvinar velit. Praesent tempor, nibh et porta rutrum, nisi velit lobortis eros, imperdiet maximus leo enim sit amet ex. Aenean rhoncus convallis est, nec pretium enim laoreet vel. Cras gravida maximus odio, eget volutpat erat venenatis eget. Aenean felis justo, suscipit sit amet porttitor in, ullamcorper eu augue. Donec eget orci sed quam bibendum volutpat sed dictum sapien. Integer consectetur lacus quis suscipit sodales. Curabitur ultricies, erat at luctus pretium, massa velit accumsan justo, vehicula gravida odio tortor id neque. Integer a nibh bibendum, tincidunt magna vitae, maximus tortor. Maecenas dignissim odio at nibh feugiat iaculis. Mauris vitae mi at quam maximus vehicula. Fusce eget interdum augue, eget auctor ante.

Aenean augue tellus, posuere vitae tincidunt in, molestie quis nulla. Pellentesque risus tellus, viverra id auctor quis, scelerisque id tortor. Ut finibus ipsum et augue fermentum, in maximus nisi porttitor. Ut non turpis sem. Pellentesque efficitur, purus quis molestie congue, arcu nisi vestibulum augue, vitae viverra justo lacus sit amet dolor. Proin libero turpis, pretium tincidunt pretium facilisis, faucibus ut velit. Mauris non accumsan ante, nec mattis ex. Cras pretium sapien magna, in laoreet eros ultrices et. Fusce eget sapien et odio condimentum elementum nec sit amet dui. Nulla facilisi. Morbi arcu nisi, pellentesque consectetur aliquet ut, posuere ac est. Nullam ac diam pretium, commodo lorem sollicitudin, aliquam tellus. Curabitur tellus metus, vestibulum ut rhoncus ut, placerat in elit.

Nullam non bibendum libero, et tempor enim. Curabitur tempus rhoncus massa sit amet varius. Fusce pellentesque purus arcu, et rhoncus nibh fringilla vitae. Donec nec porttitor nibh. Quisque eget tellus ac erat rhoncus efficitur pellentesque non elit. Vivamus at urna massa. Aliquam ac venenatis

 

Clicking here moves back to the top of this page


Post Reply