23377 Posts in 18296 Topics by 2867 members
|Go to End|
30 January 2009 at 9:16am Last edited: 12 February 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/Page.ss 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...
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.
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 Page.ss in mysite/templates/.
Where do I get the default Page template from, if not from tutorial/templates/?
30 January 2009 at 11:16pm
Hey the .ss files should be located in
31 January 2009 at 9:58am
Now *that* looks different
Thanks! And it was definitely a missing piece.
|Go to Top|