17487 Posts in 4473 Topics by 1978 members
|Go to End|
6 December 2007 at 1:18pm Last edited: 6 December 2007 1:19pm
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
6 December 2007 at 8:00pm
Not too sure if I'm a particularly clever person, but I should be able to help
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?
7 December 2007 at 1:04am
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.
|Go to Top|