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

Problems adding Page types and others


Reply

6 Posts   1543 Views

Avatar
vivianurvi

21 November 2008 at 11:11am Community Member, 5 Posts

I'm developing the tutorial and i've followed all steps but when I try to add a new page type i do all the tutorial says but they don't appear in the page type list. I built the datadase, I flushed and nothing. Could ypu help me please???

Avatar
Willr

21 November 2008 at 1:47pm Forum Moderator, 5511 Posts

Couple things to check - if you installed with 2.2.3 and the tutorial theme make sure your code is in tutorial/code/ otherwise it should be in mysite/code/. Make sure your new page type has the correct code eg its at least like.

<?php
class PageType extends Page {}
class PageType_Controller extends Page_Controller {}
?>

Avatar
vivianurvi

29 November 2008 at 9:11am (Last edited: 29 November 2008 9:12am), Community Member, 5 Posts

I must be doing something wrong. I did what you said but I still have the same problem. For example the Page Type ArticlePage doesn't appear and it's the code:

<?php

/**
* Defines the ArticlePage page type
*/
class ArticlePage extends Page {
   static $db = array(
      'Date' => 'Date',
      'Author' => 'Text'
   );
   static $has_one = array(
   );
   static $defaults = array(
      'ProvideComments' => true
   );
   static $icon = "mysite/images/treeicons/news";
   
   function getCMSFields() {
      $fields = parent::getCMSFields();
      
      $fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
      $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
      
      return $fields;
   }
}

class ArticlePage_Controller extends Page_Controller {

}

?>

What's wrong with that code?????

Avatar
Willr

1 December 2008 at 12:42pm Forum Moderator, 5511 Posts

Did you install with the tutorial option (rather then the blackcandy) and that file inside tutorial/code/

Avatar
vivianurvi

2 December 2008 at 4:09am Community Member, 5 Posts

I uninstalled and installed again and I found this that could be the reason of my problems:

File permissions
Does the webserver know where files are stored? OK (C:\wamp\www\silverstripe-v2.2.3/)
mysite/ folder exists OK
sapphire/ folder exists OK
cms/ folder exists OK
jsparty/ folder exists OK

Is the .htaccess file writeable? Unable to detect whether I can write to files. Please ensure C:\wamp\www\silverstripe-v2.2.3/.htaccess is writable.
Is the mysite/ folder writeable? Unable to detect whether I can write to files. Please ensure C:\wamp\www\silverstripe-v2.2.3/mysite is writable.
Is the tutorial/ folder writeable? Unable to detect whether I can write to files. Please ensure C:\wamp\www\silverstripe-v2.2.3/tutorial is writable.
Is the assets/ folder writeable? Unable to detect whether I can write to files. Please ensure C:\wamp\www\silverstripe-v2.2.3/assets is writable.
Is the temporary folder writeable? OK

Could it be the problem?? if it's the problem, how can I fix it??

Thank you!!

Avatar
vivianurvi

2 December 2008 at 4:16am Community Member, 5 Posts

thank you for all, I fixed it already!!.