More in this section

Forums / General Discussions / changing templates

changing templates

6 posts, 0 answered
  1. mattc
    mattc avatar
    105 posts
    Registered:
    11 Aug 2007
    10 Aug 2010
    Link to this post
    Hi all

    I just:
    Changed a couple of pages to use a new template.
    Deleted the old template.
    When I view the pages all the content has gone, presumably because the placeholders don't match.
    When I go to the revision history for the pages I get an ASP.NET error as the template doesn't exist any more.

    Not sure how I would want to handle putting content into a different template but it's not great that it vanishes. Presumably it's still in the DB?

    Any thoughts?

    Matt
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    10 Aug 2010
    Link to this post
    Hi mattc,

    If the template has been deleted you cannot get the content for it. The versioning data is serialized in [sf_version_chnges]. The data can be deserialized by using GetSpecificVersionByChangeId method of VersionManager, but since the template has been removed this could also not helps.

    var pageManager = PageManager.GetManager();
    var versManager = VersionManager.GetManager();
    var draft = pageManager.EditPage(itemId,
    false);
    pageManager.SaveChanges();
    versManager.GetSpecificVersionByChangeId(draft, versionId);

    If you create the same template with the same ContentPlaceHolders you should be able to restore the data from backend UI.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. mattc
    mattc avatar
    105 posts
    Registered:
    11 Aug 2007
    10 Aug 2010
    Link to this post
    Hi Ivan

    Thanks for your reply..
    Not ideal then for users who will expect that just changing the template will not result in losing content, although I understand the problem of different placeholders etc etc.

    Is there a plan to cope with this in some way in the upcoming versions?

    Perhaps a dialog window asking where to put existing content if they change to another template?

    Matt
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    10 Aug 2010
    Link to this post
    Hi mattc,

    We can put some warning messages and user friendly errors, but currently there are no plans to handler the content when a template has been removed. This will be logged in our system and we will consider it as a possible implementation.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Richard
    Richard avatar
    164 posts
    Registered:
    21 Nov 2009
    23 Jan 2011
    Link to this post
    There still doesn't seem to be any warning messages... as I have just discovered! :-(  I see it very important that there needs to be a way to preserve the content whilst changing the background template.

    In some other CMS I have seen there is a way to drag completed widgets off the page to the side to then reuse at a later date by dragging back on again. Is there a way to do this with Sitefinity?

    Thanks....
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    26 Jan 2011
    Link to this post
    Hi,

    This is not the case with Sitefinity 4.0. However we have very good versioning system, which lets you compare two versions of a page side by side and restore previous versions.

    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
6 posts, 0 answered