Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » can't create a new page type - trying to debug how /db/build works

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

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

Page: 1 2
Go to End
Author Topic: 4522 Views
  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: can't create a new page type - trying to debug how /db/build works Link to this post

    <?php

    class Page extends SiteTree {
       static $db = array(
       );
       static $has_one = array(
    );
    }

    class Page_Controller extends ContentController {
       function init() {
          parent::init();
          
          Requirements::themedCSS("layout");
          Requirements::themedCSS("typography");
          //Requirements::themedCSS("form");
       }
    }

    ?>

    Copy the main Page.php in mysite/code to a new file named with the same name as your theme Page.ss file...
    MyPage.php
    Then change the two lines of code
    class MyPage extends SiteTree {
    class MyPage_Controller extends ContentController {

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: can't create a new page type - trying to debug how /db/build works Link to this post

    And you also dont need to call Requirements again if you extend page FTW.

  • kjello
    Avatar
    Community Member
    7 Posts

    Re: can't create a new page type - trying to debug how /db/build works Link to this post

    I think there is some confusion. In the tutorial section there is no instruction to put the HomePage.php, the ArticlePage.php or the ArticleHolder.php files in the mysite/code directory. I had the same problem while going through the tutorial and after about 30 minutes came here to find an answer. I moved the php files to the mysite/code directory and then flushed the db and it worked fine. Is this an error in the tutorial?

    I am so far pretty impressed with the extensibility of this cms.

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: can't create a new page type - trying to debug how /db/build works Link to this post

    Well the tutorials / installation is a bit confusing with 2 folders where they could be but basically the idea is that while you are running through the tutorial you install with the 'tutorial' option hence all your code paths are /tutorial/code/* but if you install with the BlackCandy option then your code paths are /mysite/code/*

    4522 Views
Page: 1 2
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.