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 is 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
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 is null)
return;
var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs)args;
if (!pna.Target.Active)
{
//Pass page Id to the notification e-mail
string emailBody = $"The page (ID:{pna.Target.ID}) has been disabled.";
}
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageNotificationArgs
AfterOutput
Page after output notification. Occurs after the page has been rendered.
public const string AfterOutput = "DWN_STANDARD_PAGE_AFTER_OUTPUT"
Field Value
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 is null)
return;
var afterOutputArgs = (Dynamicweb.Notifications.Standard.Page.AfterOutputArgs)args;
afterOutputArgs.PageViewTemplate.SetTag("myTag", "some text");
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.AfterOutputArgs
AfterRender
Page after render notification. Occurs after the page has been rendered.
public const string AfterRender = "DWN_STANDARD_PAGE_AFTER_RENDER"
Field Value
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 is null)
return;
var afterRenderArgs = (Dynamicweb.Notifications.Standard.Page.AfterRenderArgs)args;
afterRenderArgs.Template.SetTag("myTag", "some text");
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.AfterRenderArgs
Deleted
Page deleted notification. Occurs after the page has been deleted.
public const string Deleted = "DWN_STANDARD_PAGE_DELETED"
Field Value
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 is null)
return;
var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs)args;
//Pass page Id to the notification e-mail
string emailBody = $"The page (ID:{pna.Target.ID}) has been deleted.";
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageNotificationArgs
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
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 is null)
return;
var loadedArgs = (Dynamicweb.Notifications.Standard.Page.DeviceDetectedArgs)args;
string? contentType = Context.Current?.Request?.QueryString["contenttype"];
if (!string.IsNullOrEmpty(contentType))
{
//validate content type
loadedArgs.PageView.Redirect = false;
loadedArgs.PageView.Page.ContentType = contentType;
}
if (loadedArgs.Device is 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
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 is 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
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.LoadedArgs
OnBeforeRenderParagraphs
Page notification that occurs before the paragraphs will be rendered.
public const string OnBeforeRenderParagraphs = "DWN_STANDARD_PAGE_ONBEFORERENDERPARAGRAPHS"
Field Value
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
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 is null)
return;
var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs)args;
//To do - insert your code here
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageNotificationArgs
OnGlobalTags
On global tags notification. Occurs when the globaltags are set.
public const string OnGlobalTags = "DWN_STANDARRD_PAGE_GLOBALTAGS"
Field Value
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
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageviewNotificationArgs
OnOutput
Page on output notification. Occurs before Output method activation in page template
public const string OnOutput = "DWN_STANDARD_PAGE_ON_OUTPUT"
Field Value
Examples
using Dynamicweb.Environment;
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 is null)
return;
//Add a tag to the template instance
var onOutputArgs = (Dynamicweb.Notifications.Standard.Page.OnOutputArgs)args;
onOutputArgs.PageViewTemplate.SetTag("myTag", "some text");
if (Context.Current?.Request is null)
return;
//Change expiration of the login cookie
Cookie? cookie = Context.Current.Request.GetCookie("DW_ExtranetSessionCookie");
if (cookie is not null)
{
cookie.Expires = System.DateTime.Now.AddMinutes(20);
CookieManager.UpdateCookie(cookie);
}
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.OnOutputArgs
Optimized
Page optimized notification. Occurs after the page has been optimized.
public const string Optimized = "DWN_STANDARD_PAGE_OPTIMIZED"
Field Value
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
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageNotificationArgs
PageTitle
Page title notification. Occurs when the title is assigned to a page.
public const string PageTitle = "DWN_STANDARD_PAGE_TITLE"
Field Value
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 is null)
return;
var pta = (Dynamicweb.Notifications.Standard.Page.PageTitleArgs)args;
pta.PageView.Meta.Title = "hello!";
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageTitleArgs
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
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
string emailBody = $"The page (ID:{pna.Target.ID}) state has been changed.";
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageNotificationArgs
Restored
Page deleted notification. Occurs after the page has been restored from trashbin.
public const string Restored = "DWN_STANDARD_PAGE_RESTORED"
Field Value
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
The passed PageRestoredEventArgs is Dynamicweb.Notifications.Standard.Page.PageRestoredEventArgs
Saved
Page saved notification. Occurs after the page has been saved.
public const string Saved = "DWN_STANDARD_PAGE_SAVED"
Field Value
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
string emailBody = $"The page (ID:{pna.Target.ID}) has been saved.";
}
}
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Page.PageNotificationArgs
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
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.