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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

Cannot select page type in admin panel


Go to End


2 Posts   1453 Views

Avatar
Loopy

Community Member, 20 Posts

31 January 2012 at 3:00pm

Edited: 31/01/2012 3:02pm

Hi

I have created a new page type called HomePage. To do this I have created a Homepage.php file which is located at mysite/code/HomePage.php and I have a file called HomePage.ss located at template/Homepage.ss. I have run dev/build?flush=1 and ?flush=all and I have a file in site root called silverstripe-cache at SilverStripe/silverstripe-cache set to read / write and again run dev/build?flush=1 and ?flush=all.

when I go to the admin panel i can see the option Change to HomePage in the page type drop down menu. It allows me to select this option but when I save it changes the page type to Change to Error Page and then saves it as that page type.

This then returns the statement "Generated with the default ContentController.ss template" on the site for that page but all other pages are ok.

One final thing: I have a <form action="url" method="get" </form> statement and a <script type="text/javascript" src="url"></script> statement coded into the HomePage.ss immediately after the <div id="Layout"> $Layout</div> statement.

Can anyone tell me where I have gone wrong?

Avatar
JonShutt

Community Member, 244 Posts

10 February 2012 at 12:57pm

I've had this happen when I've created a new page type, run dev/build, created a page based in this new page type, then removed the php files, run dev/build to clear the database, and then uploaded new versions of the php files, and dev/build again.

I've solved the problem in these cases by going directly into the database, finding the page in the sitetree table, and changing the page type back to 'Page'. Reloading the CMS, and then it lets me choose the right page type again..