diff options
author | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2001-06-10 13:53:44 +0000 |
---|---|---|
committer | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2001-06-10 13:53:44 +0000 |
commit | 9e4984588c7f70ddc8012859cd1e97a00c0829ad (patch) | |
tree | 69a1616107eca8348d2b12870859ac10894423ab /includes/theme.inc | |
parent | 10c96ede0a8ad30e1b1b5fd337fd8290af675852 (diff) | |
download | brdo-9e4984588c7f70ddc8012859cd1e97a00c0829ad.tar.gz brdo-9e4984588c7f70ddc8012859cd1e97a00c0829ad.tar.bz2 |
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.
Diffstat (limited to 'includes/theme.inc')
-rw-r--r-- | includes/theme.inc | 35 |
1 files changed, 24 insertions, 11 deletions
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 @@ <?php +class BaseTheme { + function links($links = array(), $status = 0, $node = 0) { + if ($status == 1) + $links = array_merge(theme_morelink($node), $links); + foreach ($links as $link) { + $_links[] = count($link) == 2 ? "<A HREF=\"$link[0]\"><FONT COLOR=\"$theme->link\">". t($link[1]) ."</FONT></A>" : 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[] = "<A HREF=\"index.php\">". t("home") ."</A>"; - $links[] = "<A HREF=\"search.php\">". t("search") ."</A>"; - $links[] = "<A HREF=\"submit.php\">". t("submit") ."</A>"; - $links[] = "<A HREF=\"account.php\">". t("account") ."</A>"; +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[] = "<A HREF=\"module.php?mod=$name\">".t($name) ."</A>"; + if (module_hook($name, "page")) $links[] = array("module.php?mod=$name", t($name)); } // if (module_exist("forum")) $links[] = "<A HREF=\"module.php?mod=forum\">".t("forum") ."</A>"; // if (module_exist("diary")) $links[] = "<A HREF=\"module.php?mod=diary\">". t("diary") ."</A>"; // if (module_exist("book")) $links[] = "<A HREF=\"module.php?mod=book\">". t("handbook") ."</A>"; - 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[] = "<A HREF=\"node.php?id=$node->nid\"><FONT COLOR=\"$theme->link\">". t("read more") ."</FONT></A>"; + $links[] = array("node.php?id=$node->nid", t("read more")); } if ($node->comment) { - $link[] = "<A HREF=\"node.php?id=$node->nid\"><FONT COLOR=\"$theme->link\">". format_plural(node_get_comments($node->nid), "comment", "comments") ."</FONT></A>"; + $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) { |