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

Forums / Developing with Sitefinity / Bulk creating of pages

Bulk creating of pages

6 posts, 0 answered
  1. Kristina
    Kristina avatar
    17 posts
    Registered:
    17 Mar 2009
    08 Apr 2009
    Link to this post
    Hi,

    We are currently evaluating Sitefinity as the CMS to port our website to.

    On our current website, we have ~1000 of pages which consists of HTML code. Is it possible to write a program to automatically import all these pages into your CMS ie: create each ASPX page and insert the HTML code??

    Thanks and Regards,

    Kristina Thong
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Apr 2009
    Link to this post
    Hi Kristina,

    You can use the following methods in your implementation if you want to create pages in Sitefinity prigrammatically.

    Telerik.Cms.CmsManager cmsManager =  new Telerik.Cms.CmsManager(); 
    // create a new page with specified title 
    Telerik.Cms.ICmsPage newPage = cmsManager.CreatePage("My Page"); 

    The process of migrating any pages to Sitefinity is individual and there is not automation process that could do everything. Most of the things have to be done manually. Everything depends on the pages you want to migrate and their structure - placeholders, controls and so on/

    Regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. Kristina
    Kristina avatar
    17 posts
    Registered:
    17 Mar 2009
    08 Apr 2009
    Link to this post
    Hi,

    Once the page is created, assuming it is in the right format. How would I get the file to the Sitefinity Site Map programatically??

    Thanks and Regards,

    Kristina Thong
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Apr 2009
    Link to this post
    Hi Kristina,

    Once you have created a page using CreatePage method the page will be with aspx extension. Could you elaborate bit more about " How would I get the file to the Sitefinity Site Map programatically??"

    However, if you have a lot of html pages there is another, but similar option that you can use. You can get all pages and add them to a directory in your project root. Then, iterate through all html pages and create them as an external pages in Sitefinity.

    Here is a sample code that demonstrates the above mentioned implementation.

            // new instance of Content Manager        
            CmsManager manager = new CmsManager(); 
             
            string path = "~/Sitefinity/html/"
            string virtualPath = VirtualPathUtility.ToAbsolute(path); 
            string physicalPath = Server.MapPath(path); 
             
            // use Directory.GetFiles to get all files in our physical path. 
            string[] Htmlfiles = Directory.GetFiles(physicalPath, "*.htm?"); 
            if (Htmlfiles != null && Htmlfiles.Length > 0) 
            { 
                foreach (string file in Htmlfiles) 
                {    
                    // create external pages based on the page name 
                    string fileName = Path.GetFileNameWithoutExtension(file); 
                    ICmsPage newPage = manager.CreatePage(fileName); 
                    newPage.PageType = CmsPageType.External; 
                    newPage.ExternalUrl = path + Path.GetFileName(file); 
                    manager.SavePage(newPage); 
                } 
            } 
            else 
            {   // if there are no pages write ... 
                Response.Write("Please add files to " + physicalPath); 
            } 

    More information about external pages can be found in our User Manual. I hope this helps.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  5. Kristina
    Kristina avatar
    17 posts
    Registered:
    17 Mar 2009
    09 Apr 2009
    Link to this post
    Hi,

    Thank you for your reply. Adding the pages as external pages in Sitefinity would work well. Is there any issues (performance, etc..) with external pages as oppose to Sitefinity pages?

    Thanks and Regards,

    Kristina Thong
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    09 Apr 2009
    Link to this post
    Hi Kristina,

    We have not experienced any problems related to external pages in Sitefinity. The difference is that, you cannot edit the content of an external page within Sitefinity. You have a link to this file
    in the dynamically created navigation of Sitefinity. and your external files do not inherit sitefinity internal page.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Register for webinar
6 posts, 0 answered