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.

General Questions /

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

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

[SOLVED] Cannot change Page Type in CMS


Go to End


5 Posts   3840 Views

Avatar
Tama

Community Member, 138 Posts

27 May 2010 at 10:26am

Edited: 27/05/2010 12:40pm

Morning

I've run into a bit of a problem with page types. We had two page types called "Section" and "Holder" which I changed to "Tier1LandingPage" and "Tier2LandingPage" by renaming the files in /mysite/code/, editing the class titles and renaming the template files in /theme/themename/templates/Layout/

Now if I try to change the page type of pages that were previous set as "Section" or "Holder" in the CMS to "Tier1 Landing Page" the page type resets itself to the first selection on the list on publish.

I've flushed the templates, rebuilt the database and at a bit of a loss about what to do.

Any suggestions appreciated.

Cheers
Tama

Avatar
Tama

Community Member, 138 Posts

27 May 2010 at 12:10pm

I solved this problem but it took a tiny bit of SQL hacking. It looks like removing Page Types which are used by existing pages breaks things.

I went into MySQL and found that ClassName for the affected pages was "" in the SiteTree table and NULL in the SiteTree_Live. These could not be changed under the Behaviour tab in the CMS.

Running the following SQL command fixed this problem:

UPDATE SiteTree SET ClassName="NewPageType" WHERE ClassName="";
UPDATE SiteTree_Live SET ClassName="NewPageType" WHERE ClassName IS NULL;

Hope this helps someone later on.

Avatar
Willr

Forum Moderator, 5523 Posts

27 May 2010 at 6:14pm

Ideally I think it should default back to 'Page' if a page type gets removed. Ticket has been created - http://open.silverstripe.org/ticket/5656

Avatar
CHD

Community Member, 219 Posts

6 July 2010 at 3:34am

Edited: 06/07/2010 3:35am

In case anybody didn't know, you can also just duplicate the page. that fixes it.
then delete the original and rename the duplicate...

Avatar
mierla

Community Member, 16 Posts

5 September 2011 at 8:57am

@Tama - just wanted to log in and say thanks for posting that solution. You saved me a lot of time and panic. :)