diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-01-12 22:53:43 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-01-12 22:53:43 +0000 |
commit | 5fa33b296281b9f0ff7ed269e2ba50acd5e6f669 (patch) | |
tree | 8ee2aa49ba096ce6d2af5ae87b727aa4b0057ef3 | |
parent | 81e14382c4826f973f7a895905b0f0e665d05b31 (diff) | |
download | brdo-5fa33b296281b9f0ff7ed269e2ba50acd5e6f669.tar.gz brdo-5fa33b296281b9f0ff7ed269e2ba50acd5e6f669.tar.bz2 |
- Made l() add 'class="active"' to the active/current URL.
-rw-r--r-- | includes/common.inc | 2 | ||||
-rw-r--r-- | includes/menu.inc | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/includes/common.inc b/includes/common.inc index 39597b8aa..55f3e6520 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -985,7 +985,7 @@ function drupal_attributes($attributes = NULL) { } function l($text, $url, $attributes = array(), $query = NULL, $fragment = NULL) { - return "<a href=\"". url($url, $query, $fragment) ."\"". drupal_attributes($attributes) .">$text</a>"; + return "<a href=\"". url($url, $query, $fragment) ."\"". ($url == $_GET['q'] ? ' class="active"' : NULL) . drupal_attributes($attributes) .">$text</a>"; } function field_get($string, $name) { diff --git a/includes/menu.inc b/includes/menu.inc index 7001e1d9b..dc37df005 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -259,11 +259,7 @@ function _menu_sort($a, $b) { function _render_item($path) { global $_list; - if ($path == $_GET["q"]) { - $css = " class=\"active\""; - } - - return "<a href=\"". url($path) ."\"$css>". $_list[$path]["title"] ."</a>"; + return l($_list[$path]["title"], $path); } |