Class: Link

Generate correct links for site navigation, based on the various combinations of page_url_style, multilingual, negotiation_method, and the currently active page.

Usage:

<?php

$nav = Link::nav ();

echo '<ul>';
foreach ($nav->tree as $item) {
    echo Link::single ($item->attr->id, $item->data);
}
echo '</ul>';

?>

Properties

protected static $url_style

protected static $multilingual

protected static $negotiation_method

protected static $nav

protected static $i18n

protected static $current

protected static $active

Methods

public static reset ()

Reset the internal state of the class.

public static url_style ($url_style)

Gets or sets the URL style (nested or flat).

public static multilingual ($multilingual)

Gets or sets whether the site is multilingual.

public static negotiation_method ($negotiation_method)

Gets or sets the language negotiation method.

public static nav ($nav)

Gets or sets the Navigation object.

public static i18n ($i18n)

Gets or sets the I18n object.

public static current ($current)

Gets or sets the current page ID. Also resets $active if it changes.

public static active ()

Gets a list of parent page IDs in order to add class="active" to them.

public static href ($id)

Generates a URL for a page ID.

public static make ($id, $title, $href)

Generates a link tag for the specified page ID and title.

public static single ($id, $title, $href)

Generates a single navigation link as a list item.

public static base_domain ()

Get the domain minus any subdomain.