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

Tutorial one - Page type Home Page not showing up in the dropdown box


Reply

5 Posts   765 Views

Avatar
WillJonMax

17 September 2012 at 8:42pm (Last edited: 17 September 2012 9:01pm), Community Member, 4 Posts

Despite trying out various solutions from the forum posts, I didn't have any luck.

My problem is, from tutorial one, I couldn't seem to create the page type, from HomePage.php, to appear in the Page Type dropdown, after rebuilding using this url http://localhost:8888/SilverStripe/mysite/dev/build?flush=all

I am using SilverStripe 3.0.1 and I installed it on my MacBook Pro's local machine. The php file, HomePage.php, is stored in this directory -> MAMP/htdocs/SilverStripe/mysite/code

At present, there are two files in this directory, HomePage.php and Page.php

The code in HomePage.php is this

<?php
class HomePage extends Page {}
class HomePage_Controller extends Page_Controller {}

My questions:-

1. Should there be a PHP closing tag ?> in this file? e.g. <?php ...... ?>
2. Every time, I rebuilt it I get a login page which says I must be an adminstrator to continue the rebuild. That's even when I am already logged in!
3. What should the correct url be in my case for rebuilding ? I guess it's http://localhost:8888/Silverstripe/mysite/dev/build?flush=1
Is 'mysite' correct?

What have I done wrong? I apprecicate any help from you

Thanks

Will

Avatar
martimiz

17 September 2012 at 10:57pm Forum Moderator, 1091 Posts

Hi WillJonMax, welcome to the forums,

First: your homepage code looks fine to me. But if dev/build/?flush=1 (all) doesn't work, then HomePage will never be added to the database, and it won't appear in the dropdown, so that's understandable.

@1: no closing php tag needed
@2: that shoudn't happen - unless you're logged in as someone that's not an administrator. Are you redirected to the login screen, or do you get some other message/error?
@3: in the URL you should add dev/build/?flush=1 to the root URL of your website. So if your site URL is localhost:8888/ then it would be localhost:8888/dev/build?flush=1. If I add an extra mysite/ to my URL, I get a 'page not found'...

Some other things you could check:

Do you have the same problem on a fresh SilverStripe install?
Do you have the same problem using another browser?
Do you have a default MAMP install or did you change any (php) settings?
Do the MAMP error logs show anything weird? Find them in application/MAMP/logs (I guess)

Martine

Avatar
WillJonMax

17 September 2012 at 11:23pm Community Member, 4 Posts

Thank you for your swift response.

@1 Ok thanks - just to be sure there!

@2 & @3 Yes, I got re-directed to a login page. It might be that I incorrectly put dev/build/?flush=1 I try do that at the root of my website.

- The SilverStripe install was smooth - no problems.

- As SliverStripe recommended using FireFox, I having been using this since then...

- I am sure I did the default MAMP install - no fiddling with php files...

- No errors in the log - everything resuming as normal..

Avatar
WillJonMax

17 September 2012 at 11:58pm Community Member, 4 Posts

I tried re-build it using this url localhost:8888/dev/build?flush=1 but came up with an error - "The requested URL /dev/build was not found on this server."

Any ideas why?

Avatar
WillJonMax

18 September 2012 at 12:39am Community Member, 4 Posts

I finally got it working now!

It's actually http://localhost:8888/SilverStripe/dev/build?flush=1 that did the build. SilverStripe is where I renamed from 'SilverStripe_3_0_1" (similar like that....)

The HomePage.php is in this directory

MAMP/htdocs/SilverStripe/mysite/code

Thanks!