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 $subheading = "";
var $quicknav = "";
var $headers = array();
var $sideblocks = array();
var $mainblocks = array();
@ -54,6 +55,11 @@ class Page {
$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) {
while(isset($this->sideblocks[$position])) $position++;
$this->sideblocks[$position] = $block;

View file

@ -20,6 +20,11 @@ function block_to_html($block, $hidable=false) {
return $html;
}
$header_html = "";
foreach($this->headers as $line) {
$header_html .= "\t\t$line";
}
$sideblock_html = "";
foreach($this->sideblocks as $block) {
$sideblock_html .= block_to_html($block, true);
@ -79,6 +84,7 @@ print <<<EOD
<head>
<title>{$this->title}</title>
<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_html
</head>