MINOR: remove dependency on RootURLController and show a default Controller template as a failback.

This commit is contained in:
Will Rossiter 2012-06-19 22:34:54 +12:00 committed by Ingo Schommer
parent eb2a0427cc
commit 8b43780e23
3 changed files with 34 additions and 2 deletions

View File

@ -1,4 +1,11 @@
---
Name: rootroutes
Before: '*'
---
Director:
rules:
'': 'Controller'
---
Name: coreroutes
After: cms/routes#modelascontrollerroutes
Before: '*'
@ -19,5 +26,4 @@ After: framework/routes#coreroutes
Director:
rules:
'admin': 'AdminRootController'
'': 'RootURLController'
'dev/buildcache/$Action': 'RebuildStaticCacheTask'
'dev/buildcache/$Action': 'RebuildStaticCacheTask'

View File

@ -274,6 +274,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
$templates = $this->template;
} else {
// Add action-specific templates for inheritance chain
$templates = array();
$parentClass = $this->class;
if($action && $action != 'index') {
$parentClass = $this->class;
@ -289,9 +290,12 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
$parentClass = get_parent_class($parentClass);
}
$templates[] = 'Controller';
// remove duplicates
$templates = array_unique($templates);
}
return new SSViewer($templates);
}

22
templates/Controller.ss Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<% base_tag %>
$MetaTags
</head>
<body>
<h1><% if $Title %>$Title<% else %>Welcome to SilverStripe<% end_if %></h1>
<% if $Content %>$Content<% else %>
<p>To get started with the SilverStripe framework:</p>
<ol>
<li>Create a <code>Controller</code> subclass (<a href="http://doc.silverstripe.org/sapphire/en/topics/controller">doc.silverstripe.org/sapphire/en/topics/controller</a>)</li>
<li>Setup the routes to your <code>Controller</code>.</li>
<li>Create a template for your <code>Controller</code> (<a href="http://doc.silverstripe.org/sapphire/en/trunk/reference/templates">doc.silverstripe.org/sapphire/en/trunk/reference/templates</a>)</li>
</ol>
<% end_if %>
<p><em>Generated with the default Controller.ss template.</em></p>
</body>
</html>