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


Go to End
Reply


12 Posts   4728 Views

Avatar
steve_nyhof

Community Member, 224 Posts

20 May 2008 at 5:01pm

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

Forum Moderator, 5513 Posts

20 May 2008 at 5:04pm

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

Avatar
kjello

Community Member, 7 Posts

23 August 2008 at 4:36am

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

Forum Moderator, 5513 Posts

23 August 2008 at 12:11pm

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

Go to Top