Class Standard.Page
- Namespace
- Dynamicweb.Notifications
- Assembly
- Dynamicweb.dll
Provides notification names for pages.
- 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.
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 == 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
The passed NotificationArgs is Dynamicweb.
AfterOutput
Page after output notification. Occurs after the page has been rendered.
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 == null)
return;
var afterOutputArgs = (Dynamicweb.Notifications.Standard.Page.AfterOutputArgs) args;
afterOutputArgs.PageViewTemplate.SetTag("myTag", "some text");
}
}
}
Remarks
The passed NotificationArgs is Dynamicweb.
AfterRender
Page after render notification. Occurs after the page has been rendered.
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 == null)
return;
var afterRenderArgs = (Dynamicweb.Notifications.Standard.Page.AfterRenderArgs) args;
afterRenderArgs.Template.SetTag("myTag", "some text");
}
}
}
Remarks
The passed NotificationArgs is Dynamicweb.
Deleted
Page deleted notification. Occurs after the page has been 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 == 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
The passed NotificationArgs is Dynamicweb.
DeviceDetected
Device detected notification. Occurs when a visitors device type and platform is detected in a pageview in the frontend.
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 == 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.
Loaded
Page loaded notification. Occurs after the page has been 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 == 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.
NotFound
Page not found notification. Occurs when the 404 handler is about to process the request.
Field Value
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
The passed NotificationArgs is Dynamicweb.
OnBeforeRenderParagraphs
Page notification that occurs before the paragraphs will be rendered.
Field Value
Remarks
The passed NotificationArgs is Standard.
OnBeforeSave
Page before save notification. Occurs before the page is saved.
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 == null)
return;
var pna = (Dynamicweb.Notifications.Standard.Page.PageNotificationArgs) args;
//To do - insert your code here
}
}
}
Remarks
The passed NotificationArgs is Dynamicweb.
OnGlobalTags
On global tags notification. Occurs when the globaltags are set.
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.
OnOutput
Page on output notification. Occurs before Output method activation in page template
Field Value
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
The passed NotificationArgs is Dynamicweb.
Optimized
Page optimized notification. Occurs after the page has been 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.
PageTitle
Page title notification. Occurs when the title is assigned to a page.
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 == null)
return;
var pta = (Dynamicweb.Notifications.Standard.Page.PageTitleArgs) args;
pta.PageView.Meta.Title = "hello!";
}
}
}
Remarks
The passed NotificationArgs is Dynamicweb.
PublishedStateChanged
Page published state changed notification. Occurs after the page "Published" state has been changed.
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
var emailBody = string.Format("The page (ID:{0}) state has been changed.", pna.Target.ID);
}
}
}
Remarks
The passed NotificationArgs is Dynamicweb.
Restored
Page deleted notification. Occurs after the page has been restored from trashbin.
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.
Saved
Page saved notification. Occurs after the page has been 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
var emailBody = string.Format("The page (ID:{0}) has been saved.", pna.Target.ID);
}
}
}
Remarks
The passed NotificationArgs is Dynamicweb.
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.
Field Value
Remarks
The passed NotificationArgs is Dynamicweb.