From 9e4984588c7f70ddc8012859cd1e97a00c0829ad Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Sun, 10 Jun 2001 13:53:44 +0000 Subject: Changes - created a BaseTheme class in theme.inc. - added links($links = array(), $status = 0, $node = 0) to BaseTheme. - modified all themes to extend from BaseTheme. - modiefied theme_link() to take advantage of $theme->links(). - theme_morelink() does not require a $theme argument. Todo - add the other standard variables and functions to BaseTheme. - some themes could use some more modifications. Weird - marvin.theme still has a story() function. --- includes/theme.inc | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'includes/theme.inc') diff --git a/includes/theme.inc b/includes/theme.inc index dc2108eab..7cb07bfc9 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1,5 +1,17 @@ link\">". t($link[1]) ."" : t($link[0]); + } + if ($status == 2) return ($_links ? implode(" | ", $_links) : ""); + else return ($_links ? "[ ". implode(" | ", $_links) ." ]" : ""); + } +} + function theme_init() { global $user, $themes; @@ -12,21 +24,22 @@ function theme_init() { return new Theme(); } -function theme_link($separator = " | ") { - $links[] = "". t("home") .""; - $links[] = "". t("search") .""; - $links[] = "". t("submit") .""; - $links[] = "". t("account") .""; +function theme_link() { + global $theme; + $links[] = array("index.php", t("home")); + $links[] = array("search.php", t("search")); + $links[] = array("submit.php", t("submit")); + $links[] = array("account.php", t("account")); foreach (module_list() as $name) { - if (module_hook($name, "page")) $links[] = "".t($name) .""; + if (module_hook($name, "page")) $links[] = array("module.php?mod=$name", t($name)); } // if (module_exist("forum")) $links[] = "".t("forum") .""; // if (module_exist("diary")) $links[] = "". t("diary") .""; // if (module_exist("book")) $links[] = "". t("handbook") .""; - return implode($separator, $links); + return $theme->links($links, 2); } @@ -97,15 +110,15 @@ function theme_blocks($region, $theme) { } } -function theme_morelink($theme, $node) { +function theme_morelink(&$node) { if ($node->body) { - $link[] = "nid\">link\">". t("read more") .""; + $links[] = array("node.php?id=$node->nid", t("read more")); } if ($node->comment) { - $link[] = "nid\">link\">". format_plural(node_get_comments($node->nid), "comment", "comments") .""; + $links[] = array("node.php?id=$node->nid", format_plural(node_get_comments($node->nid), "comment", "comments")); } - return ($link ? "[ ". implode(" | ", $link) ." ]" : ""); + return $links; } function theme_moderation_results($theme, $node) { -- cgit v1.2.3