Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Separate splash / index page?


Go to End


3 Posts   3024 Views

Avatar
darkowl

Community Member, 12 Posts

6 December 2007 at 1:18pm

Edited: 06/12/2007 1:19pm

Hi,

Okay, a question for all you clever people out there :)

What I'd like to achieve is having a "splash / index" page, manageable inside the CMS, that has a completely different layout to any sub-pages of the site. The sub-pages will be presented as usual.

At the moment, of course all pages are run through the global "Page.ss" template to get their containing layout. What I'd like to do is have a separate super template, eg. "Splash.ss" that is only used for the very first page of the site and does not touch "Page.ss" at all.

I figure that I need to create my own page type, eg. "Splash page" and assign it to the "Home" item, but I'm not sure how to tell Silverstripe how to use a special global template instead of passing it to the general "Page.ss" one.

Any ideas? Thanks in advance :)

Avatar
Design City

38 Posts

6 December 2007 at 8:00pm

Hi darkowl,

Not too sure if I'm a particularly clever person, but I should be able to help :D

There are a few ways you can do it. You could put a HomePage.ss file in /mysite/templates, in which case SS will use that for rendering pages with the page type of "Home Page". This would make your home page the 'splash' page. (also by far the easiest option, but it does mean that you loose the default home page).

The other option is a bit (not much) harder, but leaves your homepage untouched. Create a new page type called Splash. If you've gone through the tutorials, it'll be easy to do. Basically you'll need 2 new files - mysite/code/SplashPage.php and mysite/templates/SplashPage.ss. You should be able to pretty much copy & paste the SplashPage.php file (replacing all instances of HomePage with SplashPage in the file). Once you've done that a quick visit to site.com/db/build?flush=1 will enable you to make a new page which you can set to page type Splash Page.

From here, you probably want to untick the box that allows seaching the page and showing it on menus. Then you want to fill in the box "Use this page as the 'home page' for the following domains: (separate multiple domains with commas)" with the domain name, so that SS will use that as the first page of the site. Then you simply link to /home/ from the splash page and you're all done!

Clear as mud? :)

Avatar
darkowl

Community Member, 12 Posts

7 December 2007 at 1:04am

G'day DesignCity,

I tried to do the first method, but SilverStripe didn't want to play ball.

I futzed about with the second method, and after a bit of trial and error (And a lot of ?flush=1!) I managed to get it to work. Very happy indeed!

Thanks for your advice.