public static IHtmlString RenderUmbracoMacro(this System.Web.WebPages.WebPageBase ctx, string aliasOrPath, params object[] properties) { var page = CurrentOrHomePage(); //wrap the control returned in a ControlHtmlString that is used to render the control to a //string then exposes that string as a HtmlString so Razor will render the contents correctly return(new LazyHtmlString(() => RenderMacro(page.Id, aliasOrPath, properties))); }
/// <summary> /// In layout pages, renders the content of a named section as items and specifies whether the section is required. /// </summary> /// <param name="page">Page instance</param> /// <param name="name">Section name to render as items</param> /// <param name="required">True to specify that the section is required</param> /// <returns></returns> public virtual TBuilder ItemsFromSection(System.Web.WebPages.WebPageBase page, string name, bool required) { BaseControl.SectionsStack.Push(new List <string>()); var result = page.RenderSection(name, required); this.HandleResult(result); return(this as TBuilder); }
/// <summary> /// Renders the content of one page within another page as items. /// </summary> /// <param name="page">Page instance</param> /// <param name="path">The path of the page to render.</param> /// <param name="data">(Optional) An array of data to pass to the page being rendered. In the rendered page, these parameters can be accessed by using the PageData property.</param> /// <returns></returns> public virtual TBuilder ItemsFromPage(System.Web.WebPages.WebPageBase page, string path, params object[] data) { BaseControl.SectionsStack.Push(new List <string>()); var result = page.RenderPage(path, data); this.HandleResult(result); return(this as TBuilder); }
/// <summary> /// Renders the content of one page within another page to content area of the widget /// </summary> /// <param name="page"></param> /// <param name="path"></param> /// <param name="data"></param> /// <returns></returns> public virtual TBuilder ContentFromPage(System.Web.WebPages.WebPageBase page, string path, params object[] data) { BaseControl.SectionsStack.Push(null); var result = page.RenderPage(path, data); if (result != null) { this.ToComponent().ContentControls.Add(new LiteralControl(result.ToHtmlString())); } BaseControl.SectionsStack.Pop(); return(this as TBuilder); }
/// <summary> /// In layout pages, renders the content of a named section to content area of the widget /// </summary> /// <param name="page"></param> /// <param name="name"></param> /// <param name="required"></param> /// <returns></returns> public virtual TBuilder ContentFromSection(System.Web.WebPages.WebPageBase page, string name, bool required) { BaseControl.SectionsStack.Push(null); var result = page.RenderSection(name, required); if (result != null) { this.ToComponent().ContentControls.Add(new LiteralControl(result.ToHtmlString())); } BaseControl.SectionsStack.Pop(); return(this as TBuilder); }
/// <summary> /// In layout pages, renders the content of a named section as items and specifies whether the section is required. /// </summary> /// <param name="page">Page instance</param> /// <param name="name">Section name to render as items</param> /// <param name="required">True to specify that the section is required</param> /// <returns></returns> public virtual TBuilder ItemsFromSection(System.Web.WebPages.WebPageBase page, string name, bool required) { BaseControl.SectionsStack.Push(new List <string>()); var result = page.RenderSection(name, required); if (result != null) { this.ToComponent().ItemsToRender = result.ToHtmlString(); this.ToComponent().IDSToRender = BaseControl.SectionsStack.Pop(); } else { BaseControl.SectionsStack.Pop(); } return(this as TBuilder); }
/// <summary> /// Renders the content of one page within another page as items. /// </summary> /// <param name="page">Page instance</param> /// <param name="path">The path of the page to render.</param> /// <param name="data">(Optional) An array of data to pass to the page being rendered. In the rendered page, these parameters can be accessed by using the PageData property.</param> /// <returns></returns> public virtual TBuilder ItemsFromPage(System.Web.WebPages.WebPageBase page, string path, params object[] data) { BaseControl.SectionsStack.Push(new List <string>()); var result = page.RenderPage(path, data); if (result != null) { this.ToComponent().ItemsToRender = result.ToHtmlString(); this.ToComponent().IDSToRender = BaseControl.SectionsStack.Pop(); } else { BaseControl.SectionsStack.Pop(); } return(this as TBuilder); }
public static void InlineArticleImages(ref ArticleViewModel a, System.Web.WebPages.WebPageBase wpb) { string rxTagsPattern = @"\[IMAGE:(?<imageId>\d+)\]"; Regex rxTags = new Regex(rxTagsPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.ExplicitCapture); foreach (Match m in rxTags.Matches(a.Body)) { long imgId = -1; string imgHtml = ""; if (long.TryParse(m.Groups["imageId"].Value, out imgId)) { var img = a.Images.Where(i => i.FileId == imgId).FirstOrDefault(); if (img != null) { imgHtml = wpb.RenderPage("_" + ViewType.inlineimage.ToString() + ".cshtml", img).ToHtmlString(); } } a.Body = Regex.Replace(a.Body, "\\[IMAGE:" + imgId.ToString() + "\\]", imgHtml); } }
/// <summary> /// In layout pages, renders the content of a named section to content area of the widget /// </summary> /// <param name="page"></param> /// <param name="name"></param> /// <returns></returns> public virtual TBuilder ContentFromSection(System.Web.WebPages.WebPageBase page, string name) { return(this.ContentFromSection(page, name, false)); }
public static RazorLibraryCore UmbracoLibrary(this System.Web.WebPages.WebPageBase ctx) { return(new RazorLibraryCore(CurrentOrHomePage())); }
public static dynamic UmbracoPage(this System.Web.WebPages.WebPageBase ctx) { return(new DynamicNode(CurrentOrHomePage())); }