cvs: phd /themes/php chunkedhtml.php
| From: | Hannes Magnusson | Date: | Fri, 17 Aug 2007 09:18:50 +0000 |
| Subject: | cvs: phd /themes/php chunkedhtml.php | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969377549@lists.php.net to get a copy of this message | ||
bjori Fri Aug 17 09:18:50 2007 UTC
Modified files:
/phd/themes/php chunkedhtml.php
Log:
Add prev/next/up/home navigation links to the header and footer
http://cvs.php.net/viewvc.cgi/phd/themes/php/chunkedhtml.php?r1=1.4&r2=1.5&diff_format=u
Index: phd/themes/php/chunkedhtml.php
diff -u phd/themes/php/chunkedhtml.php:1.4 phd/themes/php/chunkedhtml.php:1.5
--- phd/themes/php/chunkedhtml.php:1.4 Fri Aug 10 20:16:14 2007
+++ phd/themes/php/chunkedhtml.php Fri Aug 17 09:18:50 2007
@@ -1,14 +1,47 @@
<?php
class chunkedhtml extends phpweb {
+ private $nav = "";
+
public function __construct(array $IDs, $filename, $ext = "html") {
phpdotnet::__construct($IDs, $filename, $ext, true);
if(!file_exists("html") || is_file("html")) mkdir("html") or
die("Can't create the cache directory");
}
public function header($id) {
- return "<html><body>\n";
+ $title = PhDHelper::getDescription($id, true);
+ $header = <<< HEADER
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <title>$title</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ </head>
+ <body>
+HEADER;
+ $parent = PhDHelper::getParent($id);
+ $next = $prev = $up = array(null, null);
+ if ($parent && $parent != "ROOT") {
+ $siblings = PhDHelper::getChildren($parent);
+ $prev = phpweb::createPrev($id, $parent, $siblings);
+ $next = phpweb::createNext($id, $parent, $siblings);
+ $up = array($parent.".html", PhDHelper::getDescription($parent, false));
+ }
+
+ $nav = <<< NAV
+<div style="text-align: center;">
+ <div class="prev" style="float: left;"><a
href="{$prev[0]}">{$prev[1]}</a></div>
+ <div class="next" style="float: right;"><a
href="{$next[0]}">{$next[1]}</a></div>
+ <div class="up"><a href="{$up[0]}">{$up[1]}</a></div>
+ <div class="home"><a href="index.html">PHP
Manual</a></div>
+</div>
+NAV;
+ $header .= $nav . "<hr />";
+ $this->nav = $nav;
+ return $header;
}
public function footer($id) {
- return "</body></html>\n";
+ $nav = $this->nav;
+ $this->nav = "";
+ return "<hr />$nav</body></html>\n";
}
public function __destruct() {
copy("html/manual.html", "html/index.html");