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

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


Reply

12 Posts   4631 Views

Avatar
steve_nyhof

20 May 2008 at 5:01pm Community Member, 224 Posts

<?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 {

Avatar
Willr

20 May 2008 at 5:04pm Forum Moderator, 5511 Posts

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

Avatar
kjello

23 August 2008 at 4:36am Community Member, 7 Posts

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.

Avatar
Willr

23 August 2008 at 12:11pm Forum Moderator, 5511 Posts

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/*