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 ++++++++++++++++++++++++----------- themes/example/example.theme | 9 ++++----- themes/marvin/marvin.theme | 12 ++++++------ themes/unconed/unconed.theme | 12 ++++++------ 4 files changed, 40 insertions(+), 28 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 @@ 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) { diff --git a/themes/example/example.theme b/themes/example/example.theme index 20e567173..ad8a92cff 100644 --- a/themes/example/example.theme +++ b/themes/example/example.theme @@ -9,7 +9,7 @@ *********************************************************************/ - class Theme { + class Theme extends BaseTheme { // General colorset that can be used for this theme var $foreground = "#000000"; var $background = "#FFFFFF"; @@ -30,7 +30,7 @@ @@ -50,7 +50,7 @@ } // close header function - function node($node, $main = 0) { + function node($node, $main = 0, $links = 0) { ?> @@ -83,8 +83,7 @@ diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 67746ab24..ab76f8fe1 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -10,7 +10,7 @@ *********************************************************************/ - class Theme { + class Theme extends BaseTheme { var $link = "#666699"; // General colorset that can be used for this theme @@ -39,7 +39,7 @@ @@ -66,12 +66,12 @@ print " \n"; print " \n"; print " \n"; - if ($main) print " \n"; + if ($main || $links) print " \n"; print "
links($links, $main, $node); ?>
". theme_link(" | ") ."\n"; + print "". theme_link() ."\n"; ?>
 
". theme_morelink($this, $story) ."
". $this->links($links, $main, $node) ."
\n"; print "

\n\n"; } - function node($node, $main = 0) { + function node($node, $main = 0, $links = 0) { print "\n\n"; print "\n"; print " \n"; @@ -86,7 +86,7 @@ print " \n"; print " \n"; print " \n"; - if ($main) print " \n"; + if ($main || $links) print " \n"; print "
\"\"   ". check_output($node->title) ."

". check_output($node->body, 1) ."

 
". theme_morelink($this, $node) ."
". $this->links($links, $main, $node) ."
\n"; print "

\n\n"; } @@ -168,7 +168,7 @@ [ ". theme_link(" | ") ." ]

". variable_get(site_footer, "") ."

\n"; + print "

[ ". theme_link() ." ]

". variable_get(site_footer, "") ."

\n"; ?> diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme index 08ea6fe3c..54c938dd5 100644 --- a/themes/unconed/unconed.theme +++ b/themes/unconed/unconed.theme @@ -10,7 +10,7 @@ *********************************************************************/ - class Theme { + class Theme extends BaseTheme { var $foreground = "#000000"; var $background = "#FFFFFF"; @@ -65,7 +65,7 @@ -
+
title\" -->\n"; ?> @@ -103,8 +103,8 @@ bgcolor3 ."\">bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">". theme_morelink($this, $node) .""; + if ($main || $links) + echo "bgcolor3 ."\">bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">". $this->links($links, $main, $node) .""; ?>
-
+
-- cgit v1.2.3