More in this section

Forums / Developing with Sitefinity / Accessing code from CMS

Accessing code from CMS

2 posts, 0 answered
  1. Ben
    Ben avatar
    18 posts
    Registered:
    12 May 2008
    05 Aug 2009
    Link to this post
    We're looking at providing our own Google SiteMap generator (until one is included in 4.0), and we'd like to invoke it from the CMS side of the site.  The preferred method would be for it to fire whenever a page is saved / published, and a less optimal but acceptable method would be for us to give the content manager a button / link which will invoke it.
    Can the backstage be modified in any way to accommodate either of these two techniques?
    Thanks.
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    07 Aug 2009
    Link to this post
    Hello Ben,

    Thank you for your question.


    I. You can invoke this code when a new page is being published/updated: 
    Global.asax file:
        void Application_Start(object sender, EventArgs e) 
        { 
            // Code that runs on application startup 
            Telerik.Cms.CmsManager.Executing += new EventHandler<Telerik.ExecutingEventArgs>(CmsManager_Executing); 
        } 
    void CmsManager_Executing(object sender, Telerik.ExecutingEventArgs e) 
        { 
            //CommandName for pages could be: 
            // CreatePage 
            // Publish 
            // DeletePage 
            if (e.CommandName == "Publish"
            { 
                Telerik.Cms.ICmsPage page = (Telerik.Cms.ICmsPage)e.CommandArguments; 
                //someone published the page 
                //invoke the sitemap code 
            }; 
        } 

    II. You can place a new button anywhere in the administration to do the same.

    Hope this helps.

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
2 posts, 0 answered