Commit 8b6d92fc authored by Dries's avatar Dries

- Added a template driven theme.
parent 7e80b04c
body {
margin: 0px;
padding: 0px;
color: #000000;
background-color: #fff;
font-family: verdana, arial, helvetica, sans-serif;
}
body, td, tr {
font-size: 90%;
}
a {
text-decoration: none;
font-weight: normal;
}
a:link {
color: #378CE0;
}
a:visited {
color: #036;
}
a:hover {
text-decoration: underline;
}
p {
margin: 0 0 1em 0;
padding: 0;
}
img {
border-width: 0;
}
table #menu {
background-color: #69c;
padding: 5px 5px 0px 5px;
}
#menu logo {
vertical-align: bottom;
float: left;
}
#menu #links {
text-align: right;
float: right;
color: #9cf;
}
#menu #links #primary {
font-size: 1.1em;
}
#menu #links #primary a {
color: #fff;
font-weight: bold;
}
#menu #links #secundary {
font-size: 0.7em;
}
#menu #links #secundary a {
color: #9cf;
font-weight: bold;
}
#message {
background-color: #369;
padding: 10px 10px 10px 10px;
color: #fff;
}
#main {
margin: 10px 10px 10px 10px;
padding: 15px 15px 0px 15px;
}
#sidebar {
background-color: #ddd;
}
table #node {
padding-bottom: 25px;
}
table #block {
padding: 15px 15px 15px 15px;
margin: 5px 0px 5px 0px;
}
table #comment {
border: 1px solid #bbb;
padding: 15px 15px 15px 15px;
margin: 5px 0px 5px 0px;
}
#node #title, #block #title, #node #title a {
padding-bottom: 5px;
font-weight: bold;
font-size: 1.2em;
color: #888;
}
#node #author, #comment #author {
color: #999;
font-size: 0.8em;
padding-bottom: 10px;
}
#node #taxonomy {
color: #999;
font-size: 0.8em;
padding: 15px;
}
#node #taxonomy a {
color: #369;
}
#node #content, #comment #content {
padding-top: 5px;
}
#node #links, #comment #links {
padding-top: 10px;
color: #999;
}
#node #links a, #comment #links a {
font-weight: bold;
color: #369;
}
#comment #title {
font-weight: bold;
font-size: 1.1em;
color: #888;
}
#comment #new {
text-align: right;
font-weight: bold;
font-size: 0.7em;
float: right;
color: red;
}
#block #content {
font-size: 0.9em/1.1em;
}
This diff is collapsed.
<?php
class Theme_xtemplate extends BaseTheme {
var $primary_links = "edit me";
var $secundary_links = "edit me";
var $message = "edit me";
function system($field) {
$system["name"] = "xtemplate";
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) {
$terms = array();
if (function_exists("taxonomy_node_get_terms")) {
foreach (taxonomy_node_get_terms($node->nid) as $term) {
$terms[] = l($term->name, array("or" => $term->tid), "index");
}
}
$this->template->assign(array (
"title" => ucfirst($node->title),
"taxonomy" => $this->links($terms),
"author" => format_name($node),
"date" => format_date($node->created),
"content" => ($main && $node->teaser) ?
check_output($node->teaser) :
check_output($node->body)));
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");
}
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");
}
}
function header() {
$this->template->assign(array(
"name" => variable_get("site_name", ""),
"slogan" => variable_get("site_slogan", "")));
$this->template->parse("header");
print $this->template->text("header");
?>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" id="menu">
<?php
$this->template->assign(array(
"primary" => $this->primary_links,
"secundary" => $this->secundary_links));
$this->template->parse("menu");
print $this->template->text("menu");
?>
</td>
</tr>
<tr>
<td valign="top" width="100%">
<?php
// the description block is only shown on the main page
if (!arg(0)) {
$this->template->assign(array(
"message" => $this->message));
$this->template->parse("message");
print $this->template->text("message");
}
?>
<div id="main">
<?php
}
function box($title, $content, $region = "main") {
if ($title && $content) {
$this->template->assign(array(
"title" => $title,
"content" => $content));
$this->template->parse("block");
print $this->template->text("block");
$this->template->reset("block");
}
}
function footer() {
global $user;
?>
<td valign="top" rowspan="2" id="sidebar">
<?php
theme_blocks("all", $this);
?>
</div>
</td>
</tr>
</table>
<?php
$this->template->parse("footer");
print $this->template->text("footer");
}
}
?>
<!-- BEGIN: header -->
<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>{name} - {slogan}</title>
<style type="text/css" media="all">
@import "themes/xtemplate/xtemplate.css";
</style>
</head>
<body>
<!-- END: header -->
<!-- BEGIN: menu -->
<span id="links">
<div id="secundary">{secundary}</div>
<div id="primary">{primary}</div>
</span>
<span id="logo"><a href="index.php"><img src="themes/xtemplate/images/druplicon.gif" alt="" /></a></span>
<!-- END: menu -->
<!-- BEGIN: message -->
<div id="message">{message}</div>
<!-- END: message -->
<!-- BEGIN: node -->
<div id="node">
<div id="title">{title}</div>
<span id="author">Submitted by {author} on {date}.</span>
<span id="taxonomy">{taxonomy}</span>
<div id="content">{content}</div>
<div id="links">&raquo; {links}</div>
</div>
<!-- END: node -->
<!-- BEGIN: comment_new -->
<div id="comment">
<span id="new">new</span>
<div id="title">{title}</div>
<div id="author">Posted by {author} on {date}.</div>
<div id="content">{content}</div>
<div id="links">&raquo; {links}</div>
</div>
<!-- END: comment_new -->
<!-- BEGIN: comment_old -->
<div id="comment">
<div id="title">{title}</div>
<div id="author">Posted by {author} on {date}.</div>
<div id="content">{content}</div>
<div id="links">&raquo; {links}</div>
</div>
<!-- END: comment_old -->
<!-- BEGIN: block -->
<div id="block">
<div id="title">{title}</div>
<div id="content">{content}</div>
</div>
<!-- END: block -->
<!-- BEGIN: footer -->
</body>
</html>
<!-- END: footer -->
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment