Table of Contents

Class Standard.Page

Namespace
Dynamicweb.Notifications
Assembly
Dynamicweb.dll

Provides notification names for pages.

public sealed class Standard.Page
Inheritance
Standard.Page
Inherited Members

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.Loaded)]
    public class PageLoadedObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var loadedArgs = (Dynamicweb.Notifications.Standard.Page.LoadedArgs) args;
            //Adding Meta Tag to the PageView
            loadedArgs.PageViewInstance.Meta.AddTag("my-meta-tag", "hello");
        }
    }
}

Fields

ActiveStateChanged

Page active state changed notification. Occurs after the page "Active" state has been changed.

public const string ActiveStateChanged = "DWN_STANDARD_PAGE_ACTIVESTATECHANGED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.ActiveStateChanged)]
    public class PageActiveStateChangedObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs) args;

            if (!pna.Target.Active)
            {
                //Pass page Id to the notification e-mail
                var emailBody = string.Format("The page (ID:{0}) has been disabled.", pna.Target.ID);
            }
        }
    }
}

Remarks

AfterOutput

Page after output notification. Occurs after the page has been rendered.

public const string AfterOutput = "DWN_STANDARD_PAGE_AFTER_OUTPUT"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.AfterOutput)]
    public class PageAfterOutputObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var afterOutputArgs = (Dynamicweb.Notifications.Standard.Page.AfterOutputArgs) args;
            afterOutputArgs.PageViewTemplate.SetTag("myTag", "some text");
        }
    }
}

Remarks

AfterRender

Page after render notification. Occurs after the page has been rendered.

public const string AfterRender = "DWN_STANDARD_PAGE_AFTER_RENDER"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.AfterRender)]
    public class PageAfterRenderObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var afterRenderArgs = (Dynamicweb.Notifications.Standard.Page.AfterRenderArgs) args;
            afterRenderArgs.Template.SetTag("myTag", "some text");
        }
    }
}

Remarks

Deleted

Page deleted notification. Occurs after the page has been deleted.

public const string Deleted = "DWN_STANDARD_PAGE_DELETED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.Deleted)]
    public class PageDeletedObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs) args;
            //Pass page Id to the notification e-mail
            var emailBody = string.Format("The page (ID:{0}) has been deleted.", pna.Target.ID);
        }
    }
}

Remarks

DeviceDetected

Device detected notification. Occurs when a visitors device type and platform is detected in a pageview in the frontend.

public const string DeviceDetected = "DWN_STANDARD_PAGE_DEVICEDETECTED"

Field Value

string

Examples

namespace Dynamicweb.Examples.Notifications
{
    using Dynamicweb.Frontend.Devices;

    [Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Notifications.Standard.Page.DeviceDetected)]
    public class DeviceDetectedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
	{

        public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
		{
			if (args == null)
			{
				return;
			}

			var loadedArgs = (Dynamicweb.Notifications.Standard.Page.DeviceDetectedArgs)args;
			if (!string.IsNullOrEmpty(Context.Current.Request.QueryString["contenttype"]))
			{
				var contentType = Context.Current.Request.QueryString["contenttype"];
				//validate content type
				loadedArgs.PageView.Redirect = false;
				loadedArgs.PageView.Page.ContentType = contentType;
			}



			if (loadedArgs.Device == DeviceType.Desktop)
			{
				//No mobile device detected by Dynamicweb.

				var myOwnDeviceDetectionFoundSomething = false;

				//Utilize other detection mechanism, i.e. WURFL. I.e. Dynamicweb detection of Android tablets is not 100%.
				//myOwnDeviceDetectionFoundSomething = WurflDetection()

				//If we found something else, set the information
				if (myOwnDeviceDetectionFoundSomething)
				{
					loadedArgs.Device = DeviceType.Tablet;
					loadedArgs.Platform = PlatformType.Android;
				}

			}
		}

	}
}

Remarks

The passed NotificationArgs is Standard.Page.DeviceDetectedArgs

Loaded

Page loaded notification. Occurs after the page has been loaded.

public const string Loaded = "DWN_STANDARD_PAGE_LOADED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.Loaded)]
    public class PageLoadedObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var loadedArgs = (Dynamicweb.Notifications.Standard.Page.LoadedArgs) args;
            //Adding Meta Tag to the PageView
            loadedArgs.PageViewInstance.Meta.AddTag("my-meta-tag", "hello");
        }
    }
}

Remarks

NotFound

Page not found notification. Occurs when the 404 handler is about to process the request.

public const string NotFound = "DWN_STANDARD_PAGE_NOTFOUND"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.NotFound)]
    public class PageNotFoundObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var notFoundArgs = (Dynamicweb.Notifications.Standard.Page.NotFoundArgs) args;
            // Getting the absolute path of the page
            var url = notFoundArgs.Url;
        }
    }
}

Remarks

OnBeforeRenderParagraphs

Page notification that occurs before the paragraphs will be rendered.

public const string OnBeforeRenderParagraphs = "DWN_STANDARD_PAGE_ONBEFORERENDERPARAGRAPHS"

Field Value

string

Remarks

The passed NotificationArgs is Standard.Page.OnBeforeRenderParagraphsArgs

OnBeforeSave

Page before save notification. Occurs before the page is saved.

public const string OnBeforeSave = "DWN_STANDARD_PAGE_ONBEFORESAVE"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.OnBeforeSave)]
    public class PageOnBeforeSaveObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs) args;

            //To do - insert your code here
        }
    }
}

Remarks

OnGlobalTags

On global tags notification. Occurs when the globaltags are set.

public const string OnGlobalTags = "DWN_STANDARRD_PAGE_GLOBALTAGS"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.OnGlobalTags)]
    public class PageviewObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pna = (Dynamicweb.Notifications.Standard.Page.PageviewNotificationArgs) args;

            //To do - insert your code here
        }
    }
}

Remarks

OnOutput

Page on output notification. Occurs before Output method activation in page template

public const string OnOutput = "DWN_STANDARD_PAGE_ON_OUTPUT"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
	[Subscribe(Dynamicweb.Notifications.Standard.Page.OnOutput)]
	public class PageOnOutputObserver : NotificationSubscriber
	{
		public override void OnNotify(string notification, NotificationArgs args)
		{
			if (args == null)
				return;

			//Add a tag to the template instance
			var onOutputArgs = (Dynamicweb.Notifications.Standard.Page.OnOutputArgs)args;
			onOutputArgs.PageViewTemplate.SetTag("myTag", "some text");


			//Change expiration of the login cookie
			Dynamicweb.Environment.Cookie cookie = Dynamicweb.Context.Current.Request.Cookies["DW_ExtranetSessionCookie"];
			if (cookie != null)
			{
				cookie.Expires = System.DateTime.Now.AddMinutes(20);
				Dynamicweb.Environment.CookieManager.UpdateCookie(cookie);
			}

		}
	}
}

Remarks

Optimized

Page optimized notification. Occurs after the page has been optimized.

public const string Optimized = "DWN_STANDARD_PAGE_OPTIMIZED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.Optimized)]
    public class PageOptimizedObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs) args;

            //To do - insert your code here
        }
    }
}

Remarks

PageTitle

Page title notification. Occurs when the title is assigned to a page.

public const string PageTitle = "DWN_STANDARD_PAGE_TITLE"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.PageTitle)]
    public class PageTitleObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pta = (Dynamicweb.Notifications.Standard.Page.PageTitleArgs) args;
            pta.PageView.Meta.Title = "hello!";
        }
    }
}

Remarks

PublishedStateChanged

Page published state changed notification. Occurs after the page "Published" state has been changed.

public const string PublishedStateChanged = "DWN_STANDARD_PAGE_PUBLISHEDSSTATECHANGE"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.PublishedStateChanged)]
    public class PagePublishedStateChangedObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs) args;
            //Pass page Id to the notification e-mail
            var emailBody = string.Format("The page (ID:{0}) state has been changed.", pna.Target.ID);
        }
    }
}

Remarks

Restored

Page deleted notification. Occurs after the page has been restored from trashbin.

public const string Restored = "DWN_STANDARD_PAGE_RESTORED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard.Page
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.Restored)]
    internal class PageRestoreObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pra = (Dynamicweb.Notifications.Standard.Page.PageRestoredEventArgs) args;
            //pra.PageID
        }
    }
}

Remarks

Saved

Page saved notification. Occurs after the page has been saved.

public const string Saved = "DWN_STANDARD_PAGE_SAVED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Examples.Notifications.Standard
{
    [Subscribe(Dynamicweb.Notifications.Standard.Page.Saved)]
    public class PageSavedObserver : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            if (args == null)
                return;

            var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs) args;
            //Pass page Id to the notification e-mail
            var emailBody = string.Format("The page (ID:{0}) has been saved.", pna.Target.ID);
        }
    }
}

Remarks

UrlWasAffected

Page url affected notification. Occurs after the page has been saved and one of the settings related to url generation was changed causing URL index to rebuild.

public const string UrlWasAffected = "DWN_STANDARD_PAGE_URLAFFECTED"

Field Value

string

Remarks

The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageNotificationArgs. If the UrlName, UrlUseAsWritten, MenuText or UrlIgnoreForChildren is changed, this notification fires. If the UrlName was specified before the page was edited, and the MenuText is changed, this notification will NOT be fired since the URL is not affected.

To top