From cfd31c93f1f4a4453f7f67e9bf5d3826f9cfce2f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 1 Feb 2003 19:54:19 +0000 Subject: Patch by Ax: - Bad usage of css ID's: they may be used for a single element only, but were used as #node, #block, which can occur multiple times in a single page. - Moved HTML from theme to template - thats what templates are all about! - Added support for head() hook - Added support for diffentiating between boxes and blocks. - Typo: secundary -> secondary --- themes/xtemplate/xtemplate.css | 40 +++++++-------- themes/xtemplate/xtemplate.inc | 19 ++++++- themes/xtemplate/xtemplate.theme | 93 ++++++++++++++-------------------- themes/xtemplate/xtemplate.xtmpl | 107 ++++++++++++++++++++++++--------------- 4 files changed, 141 insertions(+), 118 deletions(-) (limited to 'themes') diff --git a/themes/xtemplate/xtemplate.css b/themes/xtemplate/xtemplate.css index e1cf7fd5a..f4014fac0 100644 --- a/themes/xtemplate/xtemplate.css +++ b/themes/xtemplate/xtemplate.css @@ -28,30 +28,30 @@ p { img { border-width: 0; } -table #menu { +.header .menu { background-color: #69c; padding: 5px 5px 0px 5px; } -#menu logo { +.menu logo { vertical-align: bottom; float: left; } -#menu #links { +.menu #links { text-align: right; float: right; color: #9cf; } -#menu #links #primary { +.menu #links #primary { font-size: 1.1em; } -#menu #links #primary a { +.menu #links #primary a { color: #fff; font-weight: bold; } -#menu #links #secundary { +.menu #links #secondary { font-size: 0.7em; } -#menu #links #secundary a { +.menu #links #secondary a { color: #9cf; font-weight: bold; } @@ -67,61 +67,61 @@ table #menu { #sidebar { background-color: #ddd; } -table #node { +table .node { padding-bottom: 25px; } -table #block { +table .block, table .box { padding: 15px 15px 15px 15px; margin: 5px 0px 5px 0px; } -table #comment { +table .comment { border: 1px solid #bbb; padding: 15px 15px 15px 15px; margin: 5px 0px 5px 0px; } -#node #title, #block #title, #node #title a { +.node .title, .block .title, .box .title, .node .title a, .box .title a { padding-bottom: 5px; font-weight: bold; font-size: 1.2em; color: #888; } -#node #author, #comment #author { +.node .author, .comment .author { color: #999; font-size: 0.8em; padding-bottom: 10px; } -#node #taxonomy { +.node .taxonomy { color: #999; font-size: 0.8em; padding: 15px; } -#node #taxonomy a { +.node .taxonomy a { color: #369; } -#node #content, #comment #content { +.node .content, .comment .content { padding-top: 5px; } -#node #links, #comment #links { +.node .links, .comment .links { padding-top: 10px; color: #999; } -#node #links a, #comment #links a { +.node .links a, .comment .links a { font-weight: bold; color: #369; } -#comment #title { +.comment .title { font-weight: bold; font-size: 1.1em; color: #888; } -#comment #new { +.comment .new { text-align: right; font-weight: bold; font-size: 0.7em; float: right; color: red; } -#block #content { +.block .content, .box .content { font-size: 0.9em/1.1em; } diff --git a/themes/xtemplate/xtemplate.inc b/themes/xtemplate/xtemplate.inc index 363943ac6..dbe67106a 100644 --- a/themes/xtemplate/xtemplate.inc +++ b/themes/xtemplate/xtemplate.inc @@ -1,4 +1,4 @@ - secondary + Revision 1.1 2003/01/20 21:00:31 dries - Added a template driven theme. diff --git a/themes/xtemplate/xtemplate.theme b/themes/xtemplate/xtemplate.theme index 70cf27519..cde00817f 100644 --- a/themes/xtemplate/xtemplate.theme +++ b/themes/xtemplate/xtemplate.theme @@ -3,11 +3,12 @@ class Theme_xtemplate extends BaseTheme { var $primary_links = "edit me"; - var $secundary_links = "edit me"; + var $secondary_links = "edit me"; var $message = "edit me"; function system($field) { $system["name"] = "xtemplate"; + $system["description"] = "a template driven theme"; return $system[$field]; } @@ -36,13 +37,13 @@ class Theme_xtemplate extends BaseTheme { check_output($node->teaser) : check_output($node->body))); - if ($links = link_node($node, $main)) { - $this->template->assign("links", $this->links($links)); - } + if ($links = link_node($node, $main)) { + $this->template->assign("links", $this->links($links)); + } - $this->template->parse("node"); - print $this->template->text("node"); - $this->template->reset("node"); + $this->template->parse("node"); + print $this->template->text("node"); + $this->template->reset("node"); } function comment($comment, $link = 0) { @@ -65,73 +66,53 @@ class Theme_xtemplate extends BaseTheme { } } - function header() { + function header($title = "") { $this->template->assign(array( - "name" => variable_get("site_name", ""), - "slogan" => variable_get("site_slogan", ""))); + "title" => ($title ? $title." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")), + "head" => theme_head(), + "primary" => $this->primary_links, + "secondary" => $this->secondary_links + )); + + if (!arg(0)) { + $this->template->assign("message", $this->message); + $this->template->parse("header.message"); + } $this->template->parse("header"); print $this->template->text("header"); + } - ?> - - - - - - - -
- template->assign(array( - "message" => $this->message)); - - $this->template->parse("message"); - print $this->template->text("message"); - } + "subject" => $title, + "content" => $content + )); - ?> -
- template->parse("block"); + print $this->template->text("block"); + $this->template->reset("block"); } function box($title, $content, $region = "main") { if ($title && $content) { $this->template->assign(array( - "title" => $title, + "subject" => $title, "content" => $content)); - $this->template->parse("block"); - print $this->template->text("block"); - $this->template->reset("block"); + $this->template->parse("box"); + print $this->template->text("box"); + $this->template->reset("box"); } } function footer() { - global $user; - - ?> -
- template->assign("blocks", ob_get_contents()); + ob_end_clean(); $this->template->parse("footer"); print $this->template->text("footer"); diff --git a/themes/xtemplate/xtemplate.xtmpl b/themes/xtemplate/xtemplate.xtmpl index 2084d19d6..be2869fd8 100644 --- a/themes/xtemplate/xtemplate.xtmpl +++ b/themes/xtemplate/xtemplate.xtmpl @@ -2,68 +2,93 @@ - - {name} - {slogan} - - - - - - -
{secundary}
-
{primary}
-
- - + + {title} + + {head} + + + + + + + + - -
{message}
- + + + + +
+ +
{message}
+ +
+ -
-
{title}
- Submitted by {author} on {date}. - {taxonomy} -
{content}
- +
+
{title}
+ Submitted by {author} on {date}. + {taxonomy} +
{content}
+
-
- new -
{title}
-
Posted by {author} on {date}.
-
{content}
- -
+
+ new +
{title}
+
Posted by {author} on {date}.
+
{content}
+ +
-
-
{title}
-
Posted by {author} on {date}.
-
{content}
- -
+
+
{title}
+
Posted by {author} on {date}.
+
{content}
+ +
+ +
+
{subject}
+
{content}
+
+ + + -
-
{title}
-
{content}
+
+
{subject}
+
{content}
- +
+
+ + -- cgit v1.2.3