Getting the Inner URL of a Framed Posting in AuthoringNew Mode
Frames take up space. It's nice to have the navigation bar fixed at the top and sides of the page. However, when authoring with HtmlPlaceholderControls, these bars just occupy much needed screen space. How can we open a new page for authoring without the frames?
Part of the answer lies in the WebAuthorContext.GetAuthoringNewUrl() method. Simply pass in the destination channel and the posting's template - the method will return the URL of the posting in AuthoringNew mode. However, the returned URL still points to a page that has frames applied.
To remove the frames, you've got to insert ",frameless.htm" to the result. And voila! you've got the new posting without the frames applied.
Here's the code:
//gets the inner URL of a new posting
WebAuthorContext wac = WebAuthorContext.Current;
CmsHttpContext cmsContext = CmsHttpContext.Current;
Template t = cmsContext.Searches.GetByPath ("/Templates/myTemplate") as Template;
Channel c = cmsContext.Searches.GetByPath ("/Channels/myChannel") as Channel;
if (t!=null && c!=null)
string url = wac.GetAuthoringNewUrl(t, c);
url = url.Insert(url.IndexOf(".htm"),",frameless");