Jump to:

22976 Posts in 11702 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » [SOLVED] Cannot change Page Type in CMS

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

Page: 1
Go to End
Author Topic: 1794 Views
  • Tama
    Avatar
    Community Member
    119 Posts

    [SOLVED] Cannot change Page Type in CMS Link to this post

    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

  • Tama
    Avatar
    Community Member
    119 Posts

    Re: [SOLVED] Cannot change Page Type in CMS Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: [SOLVED] Cannot change Page Type in CMS Link to this post

    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

  • CHD
    Avatar
    Community Member
    217 Posts

    Re: [SOLVED] Cannot change Page Type in CMS Link to this post

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

  • mierla
    Avatar
    Community Member
    16 Posts

    Re: [SOLVED] Cannot change Page Type in CMS Link to this post

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

    1794 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.