cvs: phd /include PhDHelper.class.php /themes/pear pearchunkedhtml.php pearweb.php
| From: | Christian Weiske | Date: | Thu, 16 Oct 2008 21:00:47 +0000 |
| Subject: | cvs: phd /include PhDHelper.class.php /themes/pear pearchunkedhtml.php pearweb.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2248@lists.php.net to get a copy of this message | ||
cweiske Thu Oct 16 21:00:47 2008 UTC
Modified files:
/phd/include PhDHelper.class.php
/phd/themes/pear pearchunkedhtml.php pearweb.php
Log:
Make the main page display a "next" link
http://cvs.php.net/viewvc.cgi/phd/include/PhDHelper.class.php?r1=1.10&r2=1.11&diff_format=u
Index: phd/include/PhDHelper.class.php
diff -u phd/include/PhDHelper.class.php:1.10 phd/include/PhDHelper.class.php:1.11
--- phd/include/PhDHelper.class.php:1.10 Thu Oct 16 06:40:42 2008
+++ phd/include/PhDHelper.class.php Thu Oct 16 21:00:46 2008
@@ -1,5 +1,5 @@
<?php
-/* $Id: PhDHelper.class.php,v 1.10 2008/10/16 06:40:42 cweiske Exp $ */
+/* $Id: PhDHelper.class.php,v 1.11 2008/10/16 21:00:46 cweiske Exp $ */
/**
* Base class for PhDTheme
@@ -78,6 +78,20 @@
}
/**
+ * Returns the toc entry of the given ID.
+ *
+ * @param string $id ID of an element
+ *
+ * @return array toc entry array
+ *
+ * @see $IDs
+ */
+ final public function getSelf($id)
+ {
+ return $this->IDs[$id];
+ }
+
+ /**
* Returns ID of the first parental block tag with an ID.
*
* @param string $id ID of an element
http://cvs.php.net/viewvc.cgi/phd/themes/pear/pearchunkedhtml.php?r1=1.6&r2=1.7&diff_format=u
Index: phd/themes/pear/pearchunkedhtml.php
diff -u phd/themes/pear/pearchunkedhtml.php:1.6 phd/themes/pear/pearchunkedhtml.php:1.7
--- phd/themes/pear/pearchunkedhtml.php:1.6 Thu Oct 16 19:54:09 2008
+++ phd/themes/pear/pearchunkedhtml.php Thu Oct 16 21:00:46 2008
@@ -5,7 +5,7 @@
* PEAR theme for the normal-html-in-many-files version
*
* @package PhD
-* @version CVS: $Id: pearchunkedhtml.php,v 1.6 2008/10/16 19:54:09 cweiske Exp $
+* @version CVS: $Id: pearchunkedhtml.php,v 1.7 2008/10/16 21:00:46 cweiske Exp $
*/
class pearchunkedhtml extends pearweb
{
@@ -39,17 +39,21 @@
$this->next = $this->prev = $this->up = array(null, null);
$strNext = $strPrev = '';
- if ($parent && $parent != "ROOT") {
- $siblings = PhDHelper::getChildren($parent);
- $this->prev = pearweb::createPrev($id, $parent, $siblings);
+ if ($parent) {
+ if ($parent != 'ROOT') {
+ $siblings = PhDHelper::getChildren($parent);
+ } else {
+ $siblings = array($id => PhDHelper::getSelf($id));
+ }
+ $this->prev = parent::createPrev($id, $parent, $siblings);
if ($this->prev[0] == 'index') {
$this->prev = array(null, null);
}
- $this->next = pearweb::createNext($id, $parent, $siblings);
+ $this->next = parent::createNext($id, $parent, $siblings);
if ($this->next[0] == 'index') {
$this->next = array(null, null);
}
- if ($parent != 'index') {
+ if ($parent != 'index' && $parent != 'ROOT') {
$this->up = array($parent.".html", PhDHelper::getDescription($parent,
false));
}
}
http://cvs.php.net/viewvc.cgi/phd/themes/pear/pearweb.php?r1=1.1&r2=1.2&diff_format=u
Index: phd/themes/pear/pearweb.php
diff -u phd/themes/pear/pearweb.php:1.1 phd/themes/pear/pearweb.php:1.2
--- phd/themes/pear/pearweb.php:1.1 Tue Jun 24 14:54:06 2008
+++ phd/themes/pear/pearweb.php Thu Oct 16 21:00:47 2008
@@ -68,9 +68,9 @@
public function header($id) {
$ext = "." . $this->ext;
$parent = PhDHelper::getParent($id);
-
+
if (!$parent || $parent == "ROOT")
- return '<?php
+ return '<?php
sendManualHeaders("UTF-8","en");
setupNavigation(array(
"home" => array("index.php", "PEAR Manual"),
@@ -82,14 +82,14 @@
manualHeader("PEAR Manual","index.php");
?>
';
-
+
// Fetch the siblings information
$toc = array();
$siblings = PhDHelper::getChildren($parent);
foreach($siblings as $sibling => $array) {
$toc[] = array($sibling.$ext, empty($array["sdesc"]) ?
$array["ldesc"] : $array["sdesc"]);
}
-
+
// Build the PEAR navigation table
$nav = array(
'home' => array('index' . $ext, 'PEAR Manual'),
@@ -104,22 +104,22 @@
'manualHeader("' . $this->getFilename($id).$ext . '", "' .
PhDHelper::getDescription($id, true) . '");' . "\n" .
"?>\n";
}
-
+
public function footer($id) {
$ext = $this->ext . ".";
$parent = PhDHelper::getParent($id);
-
+
return '<?php manualFooter("' . $this->getFilename($id).$ext .
'", "' . PhDHelper::getDescription($id, true) . '"); ?>\n';
}
-
+
protected function createPrev($id, $parent, $siblings) {
- $ext = '.' .$this->ext;
- if (!isset($siblings[$id])) {
+ if (!isset($siblings[$id]) || $parent == 'ROOT') {
return array(null, null);
}
+ $ext = '.' .$this->ext;
// Seek to $id
- while(list($tmp,) = each($siblings)) {
+ while (list($tmp,) = each($siblings)) {
if ($tmp == $id) {
// Set the internal pointer back to $id
prev($siblings);
@@ -182,7 +182,7 @@
copy($this->outputdir . "guide.php", $this->outputdir .
"index.php");
}
}
-
+
public function format_qandaset($open, $name, $attrs) {
if ($open) {
$this->cchunk["qandaentry"] = array();
@@ -194,5 +194,5 @@
rewind($stream);
return parent::qandaset($stream);
}
-
+
}