mirror of
https://github.com/suk-ws/ph-Bookshelf.git
synced 2024-12-05 01:16:53 +08:00
修复了一些链接的错误指向,添加 php 环境说明
- 修复了正文顶端的隐藏标题错误链接到站点根的问题(删除了链接) - 修复了站点标题不能链接到站点根的问题 - 删除了 Collections 和 Chapter 的 href 标签 - 修复了 Book,Page,Segment 当激活状态的时候会错误链接到站点根的问题 - Segment 错误是当其父 Page 激活时 - 现在 Book 和 Page 在激活状态不会有 href 标签(即没有链接功能了) - 在 README 中添加了需要 php-xml 插件的声明
This commit is contained in:
parent
5b2c31b649
commit
6568161485
@ -15,6 +15,10 @@
|
||||
|
||||
下载/clone此仓库的内容,然后拖进 php 站点根目录。
|
||||
|
||||
**要求 php 环境安装了 php-xml 插件**
|
||||
(7.0及以下旧版本可能叫做 php-dom 插件)
|
||||
(安装方法应该是能 Google 到的)
|
||||
|
||||
对于 Apache(即 .htaccess 支持的 php 环境),可以直接运行。
|
||||
|
||||
对于 Nginx 或者别的之类的 php 环境,需要转换一下伪静态配置,以 .htaccess 文件内的内容为依据即可。
|
||||
|
@ -47,7 +47,7 @@ try {
|
||||
<div class="book-summary">
|
||||
<div id="book-search-input">
|
||||
<ul id="site-name" class="summary">
|
||||
<li class="chapter active"><a><?= SiteMeta::getBookshelf()->getSiteName() ?></a></li>
|
||||
<li class="chapter active"><a href="."><?= SiteMeta::getBookshelf()->getSiteName() ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<nav role="navigation">
|
||||
@ -82,7 +82,7 @@ try {
|
||||
</div>
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="."><?= PageMeta::$book->getName() ?></a>
|
||||
<a><?= PageMeta::$book->getName() ?></a>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
|
@ -54,7 +54,7 @@ class Book {
|
||||
}
|
||||
|
||||
public function getHtml (): string {
|
||||
return "<li class='link" . (PageMeta::$book->getId()==$this->id?" active":"") . "'><a class='link' href='/$this->id'>$this->name</a></li>";
|
||||
return "<li class='link" . (PageMeta::$book->getId()==$this->id?" active":"") . "'><a class='link' " . (PageMeta::$book->getId()==$this->id?"":" href='/$this->id'") . ">$this->name</a></li>";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,4 +64,4 @@ class Book {
|
||||
return BookContented::parseString(file_get_contents("./data/$this->id/book.xml"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class BookCollection {
|
||||
|
||||
public function getHtml (): string {
|
||||
$str = "";
|
||||
if ($this->name != self::ROOT) $str .= "<li class='book-collection fold" . ($this->getBook(PageMeta::$book->getId())==null?"":"on") . "'><a class='book-collection' href='#'>$this->name<i class='exc-trigger fa'></i></a><ul class='book-collection summary'>";
|
||||
if ($this->name != self::ROOT) $str .= "<li class='book-collection fold" . ($this->getBook(PageMeta::$book->getId())==null?"":" on") . "'><a class='book-collection'>$this->name<i class='exc-trigger fa'></i></a><ul class='book-collection summary'>";
|
||||
foreach ($this->array as $node) {
|
||||
$str .= $node->getHtml();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class Chapter {
|
||||
|
||||
public function getSummaryHtml (): string {
|
||||
$str = "";
|
||||
if ($this->parent != null) $str .= "<li class='chapter fold" . ($this->getPage(PageMeta::$page->getId())==null?"":"on") . "'><a class='page-chapter' href='#'>$this->name<i class='exc-trigger fa'></i></a><ul class='page-chapter summary'>";
|
||||
if ($this->parent != null) $str .= "<li class='chapter fold" . ($this->getPage(PageMeta::$page->getId())==null?"":" on") . "'><a class='page-chapter'>$this->name<i class='exc-trigger fa'></i></a><ul class='page-chapter summary'>";
|
||||
foreach ($this->childs as $node) {
|
||||
$str .= $node->getSummaryHtml();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class Page {
|
||||
}
|
||||
|
||||
public function getSummaryHtml (): string {
|
||||
$str = "<li class='page-contented chapter" . (PageMeta::$page->getId()==$this->id?" active":"") . "'><a class='page-contented' href='/" . (PageMeta::$page->getId()==$this->id?"#":(PageMeta::$book->getId()."/".$this->id)) . "'>$this->name</a>";
|
||||
$str = "<li class='page-contented chapter" . (PageMeta::$page->getId()==$this->id?" active":"") . "'><a class='page-contented' " . (PageMeta::$page->getId()==$this->id?"":(PageMeta::$book->getId()." href='/".$this->id."'")) . ">$this->name</a>";
|
||||
if (sizeof($this->segues) > 0) {
|
||||
$str .= "<ul class='page-contented summary'>";
|
||||
foreach ($this->segues as $node) {
|
||||
|
@ -50,7 +50,7 @@ class Segment {
|
||||
}
|
||||
|
||||
public function getSummaryHtml (): string {
|
||||
return "<li class='page-segment chapter'><a href='/" . (PageMeta::$page->getId()==$this->parent->getId()?"":PageMeta::$book->getId()."/".$this->parent->getId()."") . "#$this->id'>$this->name</a></li>";
|
||||
return "<li class='page-segment chapter'><a href='" . (PageMeta::$page->getId()==$this->parent->getId()?"":"/".PageMeta::$book->getId()."/".$this->parent->getId()."") . "#$this->id'>$this->name</a></li>";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class LinkCollection {
|
||||
|
||||
public function getHtml (): string {
|
||||
$str = "";
|
||||
if ($this->name != self::ROOT) $str .= "<li class='link-collection fold'><a class='link-collection chapter' href='#'>$this->name<i class='exc-trigger fa'></i></a><ul class='link-collection articles'>";
|
||||
if ($this->name != self::ROOT) $str .= "<li class='link-collection fold'><a class='link-collection chapter'>$this->name<i class='exc-trigger fa'></i></a><ul class='link-collection articles'>";
|
||||
foreach ($this->array as $node) {
|
||||
$str .= $node->getHtml();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user