+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / Copy Template

Copy Template

5 posts, 1 answered
  1. Le Corbu
    Le Corbu avatar
    16 posts
    Registered:
    27 Apr 2006
    08 Dec 2010
    Link to this post
    Hi,

    Is there (or will there be) any way to copy (duplicate) a page template?
    I haven't found anything in SDK.
    What about saving a page as template (could be a nice feature in some cases)?

    Thanks
    Udo
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    08 Dec 2010
    Link to this post
    Hello Le Corbu,

    There is no facade or public method that you can use to duplicate a template. The current implementation allows you to duplicate PageNodes only. You can use PageManager and its GetTemplate(Guid id) method to get the template you want to duplicate and then create a new template

    PageTemplate template = null;
    masterFilePath = VirtualPathUtility.ToAppRelative(masterFilePath);
    var pageManager = PageManager.GetManager();
     
    template = pageManager.CreateTemplate();
    template.Name = nameFromOld;
    template.Title = nameFromOld;
    emplate.MasterPage = masterFilePathFromOld;


    Regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
    Answered
  3. Le Corbu
    Le Corbu avatar
    16 posts
    Registered:
    27 Apr 2006
    09 Dec 2010
    Link to this post
    Hi Ivan,

    it seems to work.

    Thanks a lot!
  4. Brijesh Gadhiya
    Brijesh Gadhiya avatar
    1 posts
    Registered:
    21 Sep 2009
    20 May 2013 in reply to Ivan Dimitrov
    Link to this post
    Hello,
    I ma trying to achieve the same functionality. Could you please help me with how I can duplicate a template? I am fairly new to Sitefinity and have inherited a client website that requires some changes. Where should i be pasting this piece of code or is there a way to duplicate it from database itself? Please help me with this in detail. I am stuck with this problem since 2 days.
    Thanks
    Brijesh
  5. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    09 Sep 2016
    23 May 2013
    Link to this post
    Hi,

    Even with the latest Sitefinity release duplication of Templates is not possible. The only way you can achieve duplication is to recreate the template manually.

    We have a PITS issue opened about this feature request where you can track on its progress and vote to increase its popularity.

    Regards,
    Stefani Tacheva
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

5 posts, 1 answered