Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.5
About It:
Get it:
Rate it:
  • Helpful?
  • 3 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

adi_link

Summary

adi_link will output links from various sources, with custom attributes.

Once installed and activated, you’ll get a new tag: <txp:adi_link/>.

See the help supplied with the plugin, or have a look online.

I’ve bundled up a few ideas into one plugin. To summarise, adi_link provides functionality to:

  • take a URL via an attribute (e.g. http://www.example.com/) and output the link with text “www.example.com”
  • take a URL stored elsewhere (e.g. in a custom field)
  • render link as an “external” link (with specific class & rel)
  • take a URL from the TXP database using a supplied TXP link ID
  • parse & enhance links in an article (like jra_ext_link)
  • render HTML id, HTML rel & CSS class (which can be supplied as tag attributes)
  • render titles & link text (which can be supplied as tag attributes)
  • render section/category links
  • insert page anchor into a link
  • insert GET vars into a link

Usage

adi_link can be used as follows:

  • as a single tag: <txp:adi_link/>
  • as a container tag: <txp:adi_link> ... </txp:adi_link>

in:

  • pages
  • forms
  • articles

Examples

Simple link:

<txp:adi_link url="http://www.example.com/" />

- creates link to “http://www.example.com/”, with link text of “www.example.com”

External link:

<txp:adi_link url="www.example.com" ext_link="1"/>

- creates link with HTML attributes: class=“ext_link” & rel=“external”

Link using URL from another source:

<txp:adi_link><txp:custom_field name="link"/></txp:adi_link>

- creates a link from URL stored in a custom field called “link”

Enhance links in an article:

notextile. <txp:adi_link ext_link="1">

* "Link 1":http://www.linkone.com
* "Link 2":http://www.linktwo.com
* "Link 3":http://www.linkthree.com
notextile. </txp:adi_link>

Note: separate adi_link tags from content with blank lines & use “notextile” to prevent empty <p></p> being generated

TXP link:

<txp:adi_link id="23" link_text="New text"/>

- outputs a specific TXP link, overriding the stored link text/title

In a link form:

<txp:adi_link class="myclass" />

- when used in a Link Form, will output link with class of “myclass”

Link to page anchor:

<txp:adi_link anchor="top" link_text="back to top" />

- outputs a link to #top on current page

Link to section with additional URL vars:

<txp:adi_link section="mysection" urlvars="var1=value1&var2=value2" link_text="My Section with extras" />

- outputs a link to section “mysection”, with extra URL vars appended

Article Request Count:
Keywords/tags:
Initially released:
1 sep 2008
Posted here:
01 Sep 2008
Article modified:
17 Jun 2015

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Commenting is closed for this article.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern