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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Problem adding new page type


Reply


7 Posts   1223 Views

Avatar
quiet_islander

Community Member, 17 Posts

6 January 2010 at 2:29am

Hi, everyone:

I am going through the tutorials on my local PC running XAMPP. I have successfully added a new "Home" page type as explained in tutorial 1. However when it comes to add another two page types -- "Article" and "Article Holder" in tutorial 2, something strange happened.

As soon as I added these two php files into the mysite/code folder and updated the database, the CSS of the main site(on empty theme) will be broken. The dark grey footer with links to CMS, draft site etc would be brought up to be just below the content. This footer should ideally always stay at real bottom of the page no matter how long the content is.

Another problem is that after adding the two page types, I could never log in to the CMS again. Whenever I clicked on the log in button, I saw an error page saying "Security.SS not found" and something like that.

I have tried to add the "Article" and "Article Holder" page type first and then the "Home" but the problem remained. But if I only added the "Article" and "Article Holder" there would be no problem. So I am suspecting that it is the "Home" page type conflicting with the other two.

I am absolutely new to Silverstripe. If anyone can give me a hand, that would be much appreciated.

Avatar
Carbon Crayon

Community Member, 598 Posts

6 January 2010 at 3:19am

Hi Quiet Islander,

Could you post your code for the home page, post it into pastie.org rather than directly onto the forum, then post the link.

Aram

Avatar
quiet_islander

Community Member, 17 Posts

6 January 2010 at 1:27pm

hi, aram:

I just copied and pasted the code from the tutorial and did nothing special.

For some reason, I can't open the pastie.org site at the moment but will try it again.

Avatar
Pigeon

Community Member, 243 Posts

6 January 2010 at 2:21pm

As a stab in the dark, take a look at the controllers for your page types.

Makesure they are all of the form ClassName_Controller extends Page_Controller (where ClassName is the name of the PageType). And that if you are using the init() function, that you call parent::init() in there somewhere. Are you using the Page_Controller init method to 'require' the CSS files? If so, you might be over-riding them or something similar.

But as Aram says, taking a look at the code would be best. You can 'attach' it to a forum post too.

Avatar
quiet_islander

Community Member, 17 Posts

6 January 2010 at 10:42pm

I have attached the two php files I added to the mysite/code folder and the screenshot of broken CSS.

I first put the HomePage.php file there and built the database by appending dev/build?flush=1 to the url. Everything worked fine at this point. I could see the "home page" added as an option in the add new page dropdown in CMS.

When I added the ArticlePage.php and rebuilt the database again the problem immediately arose. As you can see in error.jpg and error2.jpg, the CSS is broken in both front end and CMS.

Attached Files
Avatar
Carbon Crayon

Community Member, 598 Posts

6 January 2010 at 11:58pm

hmm, nothing wrong with those two, could you post ur other files, templates too.

Aram

Avatar
quiet_islander

Community Member, 17 Posts

8 January 2010 at 10:38am

I didn't even touch the template files.

I am going to try it on a real server and see if the problem only appears on XAMPP.