Linode VPS Hosting - Starting at $19.95 per month

Link

No votes yet
Created: 
Sat, 2006-07-22 02:25
Available Releases: 
5.x, 6.x

 

#D7CX: I pledge that Link will have a full Drupal 7 release on the day that Drupal 7 is released.

A CCK content field which lets you add a complete link to your content types; including URL, title, and optionally a target attribute.

Requires the content module (CCK).

The link module is a one-stop content link "field" type for CCK. It provides three fields to an authorized user:

  • URL (textfield)
  • Title (textfield)
  • Open New Window (checkbox)
  • Add rel=nofollow attribute

"Title" and "Open New Window" can be optionally enabled or disabled when setting up the content field.

Link module is not necessary to add links to the navigation or primary menus. Links added to the navigation or primary menu can be done with menu module (part of Drupal core). Visit admin/build/menu on your site to configure menu and navigation links. Use Link module if you need to have users enter in a URL that is relevant to a piece of content being added.

If you were to create a field named 'My New Link', the default display of the link would be:

<div class="field_my_new_link" target="[target_value]"><a href="[URL]">[Title]</a></div>


where items between [] characters would be customized based on the user input.

 

Installation

  • Drop the entire link module directory into your 'sites/all/modules' folder
  • Enable the module from the Administration area modules page (admin/build/modules)
  • Create or Edit a CCK content-type and add a new field of type link (admin/content/types)

Configuration

Configuration is only slightly more complicated than a text field. Titles for links can be made required, optional (default), or left out entirely. If no title is provided, the trimmed version of the complete URL is may be displayed.

The target attribute may be set to _blank, top, or left out completely.

The rel=nofollow attribute prevents the link form being followed by certain search engines. More info at Wikipedia.

Data Entry

Link supports both internal and external URLs. URLs are validated on input, here are some examples of data input and the default view of a link:

 

http://drupal.org => http://drupal.org
drupal.org
 => http://drupal.org
<front>
 => http://drupal.org
node/74971
 => http://drupal.org/project/link

 

Anchors and query strings may also be used in any of these cases, including:

node/74971/edit?destination=node/74972
<front>#pager

 

Theming

You can find more information on how to theme the output (and all other CCK fields) at the CCK Handbook on Theming Individual Fields

Another popular alternative is using Content Template Module, which allows you to output links (or other field types) in any variation using PHP code. Almost formatting desired can be accomplished using one of these two methods.

Help

If you have questions or trouble, please post to the issue tracker rather than the forum.

Drupal Servers is an Arbor Drupal Development project powered by Drupal CMSLinode, and a Ninja. Drupalservers.net is NOT an official Drupal website, and is NOT endorsed by Dries Buytaert or the Drupal Association. It's sole pupose is to foster the use of the Drupal CMS to it's visitors. This site is owned and operated by Jason Moore, an Individual Member of the Drupal Association. Drupal is a registered trademark of Dries Buytaert.

All content on this website is licensed by a Creative Commons Attribution-ShareAlike license v2.0 or greater unless otherwise noted.

Creative Commons Attribution-ShareAlike license v2.0