Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Errors building homepage template from tutorial

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

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

Page: 1
Go to End
Author Topic: 1390 Views
  • tinatoerat
    Avatar
    Community Member
    16 Posts

    Errors building homepage template from tutorial Link to this post

    I am building a new homepage template following along (sorta) the first tutorial.
    Having copied the Homepage.php from the tutorial, and written it to mysite/code I then did http://localurl/db/build?flush=1 with the following results. (I'll attach a copy of the actual messages)

    .... messages that looked OK
    .....followed by info about changes that made sense in the light of the change I'd made
    .....more OK messages, then

    Warning: Cannot modify header information - headers already sent by (output started at C:\Apps\xampplite\htdocs\silverstripe\sapphire\core\model\DatabaseAdmin.php:137) in C:\Apps\xampplite\htdocs\silverstripe\sapphire\core\Debug.php on line 151
    Error

    The website server has not been able to respond to your request.

    And that was all..... Removing homepage.php and rebuilding restores the system to working state, but doesn't get me any further in building a new homepage template.

    Where have I gone wrong?

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Errors building homepage template from tutorial Link to this post

    Could you try put the site into dev mode and find out the error details. You can put it into dev mode by adding 'Director::set_environment_type("dev");' to your mysite/_config.php file

  • tinatoerat
    Avatar
    Community Member
    16 Posts

    Re: Errors building homepage template from tutorial Link to this post

    I hope this is helpful.
    I'll attach the full error response, but the key part is:
    FATAL ERROR: Bad class to singleton() - HomePage
    At line 85 in C:\Apps\xampplite\htdocs\silverstripe\sapphire\core\Core.php

    user_error(Bad class to singleton() - HomePage,256)
    line 85 of Core.php

    singleton(HomePage)
    line 175 of DatabaseAdmin.php

    DatabaseAdmin->doBuild()
    line 90 of DatabaseAdmin.php

    DatabaseAdmin->build(Array)
    line 261 of Controller.php

    Controller->run(Array)
    line 104 of Director.php

    Director::direct(/db/build)
    line 158 of main.php

  • tinatoerat
    Avatar
    Community Member
    16 Posts

    Re: Errors building homepage template from tutorial Link to this post

    Hmmm did you know you can't attach another file when editing your post?

    So I'm attaching Homepage.php in a separate response, since that's the significant change I've made.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Errors building homepage template from tutorial Link to this post

    Yea the file attachment system has been completely remodelled in the next version of the forum. As for the error it could be because your class is 'HomePage' but that file you attached has the filename 'Homepage' that would cause SS to get lost.

  • tinatoerat
    Avatar
    Community Member
    16 Posts

    Re: Errors building homepage template from tutorial Link to this post

    Well, well, well...you are right. Rename the file to HomePage.php has fixed the error.

    I wondered about that when I was attaching the file and noted the discrepancy, but I thought "not in this day and age, surely".

    Thanks for the help.. I will continue to blunder my way around

    Anita

    1390 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.