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.

Archive /

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

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

Using a different template for the home page


Go to End
Reply


11 Posts   32538 Views

Avatar
bcm75204

Community Member, 6 Posts

13 May 2008 at 5:53am

I went through the "Using a different template for the home page" section of the tutorial several times and I cannot get this to work. I want my home page to have a different layout than the rest of the site. I did multiple flushes and nothing changed. Any suggestions?

Thank you.

Avatar
trevor

53 Posts

13 May 2008 at 6:47am

Hi,

One thing you could check is did you also change the page type for the home page in the cms?

If you followed the tutorial exactly then it should work.

Regards

Trevor

Avatar
bcm75204

Community Member, 6 Posts

13 May 2008 at 7:58am

The option to change it does not appear in the dropdown in the cms. Anybody else having this problem?

Thanks.

Avatar
bcm75204

Community Member, 6 Posts

13 May 2008 at 9:35am

Can somebody tell me which folder HomePage.ss goes into?

Is it /public_html/themes/blackcandy/templates/?

or /public_html/themes/blackcandy/templates/Layout/

Thanks.

Avatar
quicked

Community Member, 32 Posts

13 May 2008 at 1:06pm

If your HomePage is completely different put the template directly under templates/
If it is based on Page.ss then put it under templates/Layouts.
You will need a file called HomePage.php in mysite/code and you will need to select that page type in the CMS.
To refresh hold down ctrl and add ?flush=1 to the URL. Sometimes i have had to change browsers to see a change reflected.

Avatar
bcm75204

Community Member, 6 Posts

14 May 2008 at 9:45am

It still doesn't work. The option to create a home page does not appear in the dropdown option in the CMS. Anybody out there know how to use this?

Avatar
quicked

Community Member, 32 Posts

14 May 2008 at 10:39am

Somebody correct me if I am wrong, but if you create a file called WhateverPage.php in mysite/code then db/build/?flush=1 (do it in the CMS), then 'Create a WhateverPage' has to appear in the drop down for create page type. If not, something is very wrong. It seems to be it is practically the premise for the whole system. What options appear in your dropdown?

Avatar
DesignCity

38 Posts

14 May 2008 at 2:25pm

bcm75204 - check the tutorials more carefully (http://doc.silverstripe.com/doku.php?id=tutorial:1-building-a-basic-site#using_a_different_template_for_the_home_page) - If you follow them it will show you how to add pagetypes to the CMS. How you then style them depends on the template that is used for the site.

Given I don't know much of your setup, here's how I think you would add a home page:

1. Add HomePage.php to /mysite/code/ (with the same code as listed under http://doc.silverstripe.com/doku.php?id=tutorial:1-building-a-basic-site#creating_a_new_page_type)

2. If you want the home page to be COMPLETELY different, add a template file called HomePage.ss to /themes/blackcandy/templates/. You can copy and paste the data from Page.ss into it and make any changes you want. If you want to edit the CSS of the design, you can either include a new stylesheet into the page or just make additions to BlackCandy's (found in /themes/blackcandy/css/).

3. This point in the tutorial is key - "Every page type also has a database table corresponding to it. Every time we modify the database, we need to rebuild it. We can do this by going to http://localhost:3000/db/build?flush=1." You need to flush the database by visiting /db/build and then refresh the CMS (F5) or the new pagetype will not be available.

Go to Top