diff --git a/includes/theme.inc b/includes/theme.inc index 4bc6e57ea8da7f0edfde4ad1b8973b7ea78e71a6..d37b73cd9cc437c7c2b52ebac9e3e9b693a2cba3 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1,16 +1,16 @@ <?php class BaseTheme { - function links($links = array(), $status = 0, $node = 0) { - if ($status == 1) - $links = array_merge(theme_morelink($node), $links); - + function links(&$links, $state = 0) { + // $state = 0 : default behaviour + // $state = 1 : main page + // $state = 2 : theme_link() + // Subject to change coz its messy 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 ($link[0]) $_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) ." ]" : ""); + return ($_links ? implode(" | ", $_links) : ""); } } @@ -112,17 +112,6 @@ function theme_blocks($region, $theme) { } } -function theme_morelink(&$node) { - if ($node->body) { - $links[] = array("node.php?id=$node->nid", t("read more")); - } - if ($node->comment) { - $links[] = array("node.php?id=$node->nid", format_plural(node_get_comments($node->nid), "comment", "comments")); - } - - return $links; -} - function theme_moderation_results($theme, $node) { foreach (explode(";", $node->users) as $vote) { if ($vote) { diff --git a/themes/example/example.theme b/themes/example/example.theme index caa3c951853e028c79944685678eeb72ba8f3298..dae6300a09dd2336aec05e93d8dd401ed90fc756 100644 --- a/themes/example/example.theme +++ b/themes/example/example.theme @@ -83,7 +83,7 @@ function node($node, $main = 0, $links = 0) { <TR> <TD COLSPAN="2"> <?php - if ($main || $links) echo $this->links($links, $main, $node); + if (node_links($links, $node, $main)) echo $this->links($links, $main); ?> </TD> diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 108f4acfc753238a694e820d944ef67e1869fc19..15d11eb62375a2b50ff05b3d24c3a2092e046d96 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -63,7 +63,7 @@ function node($node, $main = 0, $links = 0) { print " <TD COLSPAN=\"2\"><P>". check_output($node->body, 1) ."</P></TD>\n"; print " </TR>\n"; print " <TR><TD COLSPAN=\"2\"> </TD></TR>\n"; - if ($main || $links) print " <TR><TD COLSPAN=\"2\">". $this->links($links, $main, $node) ."</TD></TR>\n"; + if (node_links($links, $node, $main)) print " <TR><TD COLSPAN=\"2\">". $this->links($links, $main) ."</TD></TR>\n"; print "</TABLE>\n"; print "<BR><BR>\n\n"; } diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme index cd20fe3ab38eab05107b09c1b404b30c28a77e25..a2b95a4db1854affcd5fc4a1fb0c23104e9ad514 100644 --- a/themes/unconed/unconed.theme +++ b/themes/unconed/unconed.theme @@ -101,8 +101,8 @@ function node($node, $main = 0, $links = 0) { </TD> </TR> <?php - if ($main || $links) - echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">". $this->links($links, $main, $node) ."</TD></TR>"; + if (node_links($links, $node, $main)) + echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">". $this->links($links, $main) ."</TD></TR>"; ?> </TABLE></TD></TR></TABLE><BR> <?php