Drupal l()

Drupal 6 Syntax:
l($text, $path, $options = array())

This function correctly handles aliased paths, and allows themes to highlight links to the current page correctly, so all internal links output by modules should be generated by this function if possible.


$text The text to be enclosed with the anchor tag.

$path The Drupal path being linked to, such as “admin/content/node”. Can be an external or internal URL.

* If you provide the full URL, it will be considered an external URL.
* If you provide only the path (e.g. “admin/content/node”), it is considered an internal link. In this case, it must be a system URL as the url() function will generate the alias.
* If you provide ”, it generates a link to the site’s base URL (again via the url() function).
* If you provide a path, and ‘alias’ is set to TRUE (see below), it is used as is.

$options An associative array of additional options, with the following keys:

* ‘attributes’ An associative array of HTML attributes to apply to the anchor tag.
* ‘query’ A query string to append to the link, or an array of query key/value properties.
* ‘fragment’ A fragment identifier (named anchor) to append to the link. Do not include the ‘#’ character.
* ‘absolute’ (default FALSE) Whether to force the output to be an absolute link (beginning with http:). Useful for links that will be displayed outside the site, such as in an RSS feed.
* ‘html’ (default FALSE) Whether the title is HTML, or just plain-text. For example for making an image a link, this must be set to TRUE, or else you will see the escaped HTML.
* ‘alias’ (default FALSE) Whether the given path is an alias already.

Importantly, don’t forget to add $base_url with ‘path’ for correct path encoding.