support for adding headers to a page

git-svn-id: file:///home/shish/svn/shimmie2/trunk@44 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-05-01 12:41:44 +00:00
parent a9abf77ba9
commit 32e4af6a23
2 changed files with 12 additions and 0 deletions

View file

@ -39,6 +39,7 @@ class Page {
var $heading = ""; var $heading = "";
var $subheading = ""; var $subheading = "";
var $quicknav = ""; var $quicknav = "";
var $headers = array();
var $sideblocks = array(); var $sideblocks = array();
var $mainblocks = array(); var $mainblocks = array();
@ -54,6 +55,11 @@ class Page {
$this->subheading = $subheading; $this->subheading = $subheading;
} }
public function add_header($line, $position=50) {
while(isset($this->headers[$position])) $position++;
$this->headers[$position] = $line;
}
public function add_side_block($block, $position=50) { public function add_side_block($block, $position=50) {
while(isset($this->sideblocks[$position])) $position++; while(isset($this->sideblocks[$position])) $position++;
$this->sideblocks[$position] = $block; $this->sideblocks[$position] = $block;

View file

@ -20,6 +20,11 @@ function block_to_html($block, $hidable=false) {
return $html; return $html;
} }
$header_html = "";
foreach($this->headers as $line) {
$header_html .= "\t\t$line";
}
$sideblock_html = ""; $sideblock_html = "";
foreach($this->sideblocks as $block) { foreach($this->sideblocks as $block) {
$sideblock_html .= block_to_html($block, true); $sideblock_html .= block_to_html($block, true);
@ -79,6 +84,7 @@ print <<<EOD
<head> <head>
<title>{$this->title}</title> <title>{$this->title}</title>
<link rel="stylesheet" href="$data_href/themes/default/style.css" type="text/css"> <link rel="stylesheet" href="$data_href/themes/default/style.css" type="text/css">
$header_html
<script src='$data_href/themes/default/sidebar.js' type='text/javascript'></script> <script src='$data_href/themes/default/sidebar.js' type='text/javascript'></script>
$script_html $script_html
</head> </head>