Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: XSLT function only renders in preview in the console

$
0
0
Add Inline C# Function
  • Name: PageRequestReason
  • Namespace: Composite.Web.Request
  • (click "Finish")
Paste in code below and save.
using System;
using Composite.Core.WebClient.Renderings.Page;

namespace Composite.Web.Request
{
    public static class InlineMethodFunction
    {
        public static string PageRequestReason()
        {
            return PageRenderer.RenderingReason.ToString();
        }
    }
}
This should give you a new function Composite.Web.Request.PageRequestReason which return one of the following string values, depending on the context of a page rendering:
    /// Undefined (computer language for "what?? No page is being rendered now, why are you calling me??")
    Undefined

    /// A page was requested through a browser
    PageView

    /// A page is viewed from C1 Console's browser
    C1ConsoleBrowserPageView

    /// A page is reneder from withing an "Edit page" workflow
    PreviewUnsavedChanges

    /// A page is rendered to generate an image to be used for function/template visualization
    ScreenshotGeneration
Hope this helps!

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>