Daniel H.
Daniel H.

Reputation: 432

How to create a page in silverstripe that does not call the default Page.ss template

I need to make an "under construction" page for the home page.

All of the templates I have created use the default Page.ss to build the head/nav and footer. but in the construction page I don't want to do that.

How can I omit the use of Page.ss in my new page type?

This is my Page.ss that is used as the foundation to create every page type

<!doctype html>
<html lang="en">
<head>
    <% base_tag %>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    $MetaTags
</head>

<body>
    <% include GraphicHeader %>
    <% include HeadNav %>

    $Layout

    <% include Footer %>           
</body>

Upvotes: 2

Views: 264

Answers (2)

wmk
wmk

Reputation: 4626

You have two files called Page.ss in your theme.

  • /themes/yourtheme/templates/Page.ss for the outer strcuture of your site (<head> and <body>)
  • /themes/yourtheme/templates/Layout/Page.ss is included via the $Layout variable and defines the inner structure per page type.

Your Page_Controller automatically tries to render itself using a template called like it's related Page class (e.g. HomePage) and searches for the Layout and basic template. If it doesn't find one, it falls back to to templates named like the parent class etc. until it finds your Page.ss.

This is valid for both templates, the outer and the inner layout.

So if your class for the home page is called HomePage simply put a HomePage.ss inside /themes/yourtheme/templates/ and it's taken by HomePageand its subclasses.

Using the maintenance module (see Robbie Averill's answer) might be a more robust solution in your case.

Upvotes: 2

scrowler
scrowler

Reputation: 24406

You could use a maintenance mode module like this one, and modify the page to say "under construction" instead.

This would allow you to work on the site while having the public see "under construction" until you're ready to turn it on.

Upvotes: 1

Related Questions