mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
BUGFIX Fixed 404 display
This commit is contained in:
parent
e024be8806
commit
5d48bc97de
@ -552,6 +552,8 @@ class DocumentationService {
|
|||||||
|
|
||||||
$folder = Controller::join_links($base, $relative);
|
$folder = Controller::join_links($base, $relative);
|
||||||
|
|
||||||
|
if(!is_dir($folder)) return false;
|
||||||
|
|
||||||
$handle = opendir($folder);
|
$handle = opendir($folder);
|
||||||
|
|
||||||
if($handle) {
|
if($handle) {
|
||||||
|
@ -492,11 +492,13 @@ class DocumentationViewer extends Controller {
|
|||||||
return DBField::create("HTMLText", $html);
|
return DBField::create("HTMLText", $html);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// if no page found then we may want to get the listing of
|
// If no page found then we may want to get the listing of the folder.
|
||||||
// the folder
|
// In case no folder exists, show a "not found" page.
|
||||||
if($url = $this->Remaining) {
|
$module = $this->getModule();
|
||||||
$pages = DocumentationService::get_pages_from_folder($this->getModule(), implode('/', $url), false);
|
$url = $this->Remaining;
|
||||||
|
if($url && $module) {
|
||||||
|
$pages = DocumentationService::get_pages_from_folder($module, implode('/', $url), false);
|
||||||
|
// If no pages are found, the 404 is handled in the same template
|
||||||
return $this->customise(array(
|
return $this->customise(array(
|
||||||
'Title' => DocumentationService::clean_page_name(array_pop($url)),
|
'Title' => DocumentationService::clean_page_name(array_pop($url)),
|
||||||
'Pages' => $pages
|
'Pages' => $pages
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p>Nothing to see here</p>
|
<% include DocNotFound %>
|
||||||
<% end_if %>
|
<% end_if %>
|
24
templates/Includes/DocNotFound.ss
Normal file
24
templates/Includes/DocNotFound.ss
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<div class="warningBox" id="pageNotFoundWarning">
|
||||||
|
<div class="warningBoxTop">
|
||||||
|
<h1>We're sorry…</h1>
|
||||||
|
<p>The page you are looking for does not exist, or might have moved.
|
||||||
|
<h5>Perhaps you could…</h5>
|
||||||
|
<p>return to the <a href="$BaseHref">homepage</a> or try searching (see input box on the top right).</p>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<h5>Search results for similar/related phrases</h5>
|
||||||
|
<ul class="resetStyle">
|
||||||
|
<li><a href="#">Installing</a></li>
|
||||||
|
<li><a href="#">Upgrading</a></li>
|
||||||
|
<li><a href="#">Server-requirements</a></li>
|
||||||
|
<li><a href="#">Suggested-web-hosts</a></li>
|
||||||
|
</ul>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
<!-- <div class="warningBoxBottom">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#">Report a missing link</a></li>
|
||||||
|
<li><a href="#">Report a bug or a concren</a></li>
|
||||||
|
</ul>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
@ -1 +1,3 @@
|
|||||||
<div id="table-of-contents" class="sidebar-box"></div>
|
<% if Content %>
|
||||||
|
<div id="table-of-contents" class="sidebar-box"></div>
|
||||||
|
<% end_if %>
|
@ -3,12 +3,14 @@
|
|||||||
<% if Content %>
|
<% if Content %>
|
||||||
$Content
|
$Content
|
||||||
<% else %>
|
<% else %>
|
||||||
<p>Woops page not found</p>
|
<% include DocNotFound %>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% if Content %>
|
||||||
<div id="right-column">
|
<div id="right-column">
|
||||||
<% include DocTableOfContents %>
|
<% include DocTableOfContents %>
|
||||||
<% include DocInThisModule %>
|
<% include DocInThisModule %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end_if %>
|
||||||
</div>
|
</div>
|
Loading…
x
Reference in New Issue
Block a user