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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[solved] Page.php: same code renders differently, when renamed

Go to End

5 Posts   1332 Views


Community Member, 6 Posts

30 January 2009 at 9:16am

Edited: 12/02/2009 10:00pm

fresh Silverstripe install:

* I copy the /tutorial/codePage.php to /mysite/code/HWPage.php
* edit the file to have HWPage and HWPage_Controller instead of Page etc.
* I copy /tutorial/templates/ to /mysite/templates/HWPage.php
* flush, rebuild, flush

* i log into the CMS
* create a new page of type Page
* type "Hello World" in the content-field; name of page is Helloworld1; save & publish
* create a new page of type HWPage
* type "Hello World" in the content-field; name of page is Helloworld2; save & publish

* i go to the site and see links to both pages in the menu (top level, both)

from what i did i expect both pages to be rendered identically

Helloworld1 (type: Page) looks like expected: default menu on it, default theme etc.
Helloworld2 (type: HWPage) has no menu on it, the layout is distorted (margins in top, middle and bottom do not align) and only roughly resembles the theme

since i copied the code of Page[.php .ss] to HWPage, I expected it to look alike.

I also tried to inherit HWPage from Page, instead of from SiteTree; no difference.
I did try it on two different installs/machines; result is the same.

I attached an img which displays the two pages as rendered.

Am I not getting part of the concept? What is going wrong here?
Any help welcome...


Attached Files

Forum Moderator, 5523 Posts

30 January 2009 at 10:07am

HWPage should extend from Page. and HWPage_Controller from Page_Controller.

All your template stuff (ss files, css, images) should go in the theme. (eg themes/yourcustomtheme/). It looks like from that screenshot you are running BlackCandy and not the tutorial theme at all so if you want to copy code / templates you should be doing it from mysite/code/ and template files from themes/blackcandy/ as the mixing the tutorial templates with the blackcandy css could have odd results.


Community Member, 6 Posts

30 January 2009 at 10:49pm

Ok, I get the point.
I *do* find a Page.php in mysite/code/, yet I don't find a in mysite/templates/.
Where do I get the default Page template from, if not from tutorial/templates/?


Community Member, 81 Posts

30 January 2009 at 11:16pm

Hey the .ss files should be located in



Community Member, 6 Posts

31 January 2009 at 9:58am


Now *that* looks different :-)
Thanks! And it was definitely a missing piece.

Best regards,