2003-01-20 21:00:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Theme_xtemplate extends BaseTheme {
|
|
|
|
|
|
|
|
function system($field) {
|
|
|
|
$system["name"] = "xtemplate";
|
2003-02-01 19:54:19 +00:00
|
|
|
$system["description"] = "a template driven theme";
|
2003-01-20 21:00:31 +00:00
|
|
|
|
|
|
|
return $system[$field];
|
|
|
|
}
|
|
|
|
|
|
|
|
function Theme_xtemplate() {
|
|
|
|
include_once("themes/xtemplate/xtemplate.inc");
|
|
|
|
|
|
|
|
$this->template = new XTemplate("themes/xtemplate/xtemplate.xtmpl");
|
|
|
|
$this->template->SetNullBlock(" "); // "" doesnt work!
|
|
|
|
}
|
|
|
|
|
|
|
|
function node($node, $main) {
|
|
|
|
|
|
|
|
$this->template->assign(array (
|
|
|
|
"title" => ucfirst($node->title),
|
|
|
|
"author" => format_name($node),
|
|
|
|
"date" => format_date($node->created),
|
|
|
|
"content" => ($main && $node->teaser) ?
|
|
|
|
check_output($node->teaser) :
|
|
|
|
check_output($node->body)));
|
|
|
|
|
2003-02-09 17:39:40 +00:00
|
|
|
if ($taxonomy = taxonomy_link("taxonomy terms", $node)) {
|
|
|
|
$this->template->assign("taxonomy", $this->links($taxonomy));
|
|
|
|
}
|
|
|
|
|
2003-02-01 19:54:19 +00:00
|
|
|
if ($links = link_node($node, $main)) {
|
|
|
|
$this->template->assign("links", $this->links($links));
|
|
|
|
}
|
2003-01-20 21:00:31 +00:00
|
|
|
|
2003-02-01 19:54:19 +00:00
|
|
|
$this->template->parse("node");
|
|
|
|
print $this->template->text("node");
|
|
|
|
$this->template->reset("node");
|
2003-01-20 21:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function comment($comment, $link = 0) {
|
|
|
|
$this->template->assign(array (
|
|
|
|
"title" => ucfirst($comment->subject),
|
|
|
|
"author" => format_name($comment),
|
|
|
|
"date" => format_date($comment->timestamp),
|
|
|
|
"content" => check_output($comment->comment),
|
|
|
|
"links" => $link));
|
|
|
|
|
|
|
|
if ($comment->new) {
|
|
|
|
$this->template->parse("comment_new");
|
|
|
|
print $this->template->text("comment_new");
|
|
|
|
$this->template->reset("comment_new");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->template->parse("comment_old");
|
|
|
|
print $this->template->text("comment_old");
|
|
|
|
$this->template->reset("comment_old");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-01 19:54:19 +00:00
|
|
|
function header($title = "") {
|
2003-01-20 21:00:31 +00:00
|
|
|
$this->template->assign(array(
|
2003-02-01 19:54:19 +00:00
|
|
|
"title" => ($title ? $title." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")),
|
|
|
|
"head" => theme_head(),
|
2003-02-09 08:10:07 +00:00
|
|
|
"links" => $this->links(link_page())
|
2003-02-01 19:54:19 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
if (!arg(0)) {
|
|
|
|
$this->template->parse("header.message");
|
|
|
|
}
|
2003-01-20 21:00:31 +00:00
|
|
|
|
|
|
|
$this->template->parse("header");
|
|
|
|
print $this->template->text("header");
|
2003-02-01 19:54:19 +00:00
|
|
|
}
|
2003-01-20 21:00:31 +00:00
|
|
|
|
2003-02-01 19:54:19 +00:00
|
|
|
function block($title, $content, $region = "main") {
|
2003-01-20 21:00:31 +00:00
|
|
|
$this->template->assign(array(
|
2003-02-01 19:54:19 +00:00
|
|
|
"subject" => $title,
|
|
|
|
"content" => $content
|
|
|
|
));
|
2003-01-20 21:00:31 +00:00
|
|
|
|
2003-02-01 19:54:19 +00:00
|
|
|
$this->template->parse("block");
|
|
|
|
print $this->template->text("block");
|
|
|
|
$this->template->reset("block");
|
2003-01-20 21:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function box($title, $content, $region = "main") {
|
|
|
|
if ($title && $content) {
|
|
|
|
$this->template->assign(array(
|
2003-02-01 19:54:19 +00:00
|
|
|
"subject" => $title,
|
2003-01-20 21:00:31 +00:00
|
|
|
"content" => $content));
|
|
|
|
|
2003-02-01 19:54:19 +00:00
|
|
|
$this->template->parse("box");
|
|
|
|
print $this->template->text("box");
|
|
|
|
$this->template->reset("box");
|
2003-01-20 21:00:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function footer() {
|
2003-02-01 19:54:19 +00:00
|
|
|
// unfortunately, theme_blocks PRINTS the blocks instead of RETURNING them.
|
|
|
|
// so we need some output buffering
|
|
|
|
ob_start();
|
|
|
|
theme_blocks("all");
|
|
|
|
$this->template->assign("blocks", ob_get_contents());
|
|
|
|
ob_end_clean();
|
2003-01-20 21:00:31 +00:00
|
|
|
|
|
|
|
$this->template->parse("footer");
|
|
|
|
print $this->template->text("footer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|