Developer forum
E-mail notifications
Events for PageCreated
Are there any notifications that can fires when a page is created in admin? I have a potential customer who would like to have a page copied to all language areas when it is created in standard language.
Regards / Aki
Replies
New or old interface? We can add one in a later release - untill then I'm sure we can find a workaround...
/Aki
Add this to your Global.asax:
It works - but it might be a little fragile:
Sub Application_EndRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim app As HttpApplication = CType(sender, HttpApplication)
Dim cmd As String = Base.ChkString(Base.Request("cmd"))
Dim PageID As Integer = Base.ChkInteger(Base.Request("ID"))
If cmd = "createpage" Or (cmd = "save" And PageID = 0 And app.Request.ServerVariables("SCRIPT_NAME").Equals("/Admin/Content/PageEdit.aspx", StringComparison.InvariantCultureIgnoreCase)) Then
'This is a new page....
Dim p As Content.Page = Content.Page.GetPageBySql("SELECT TOP 1 * FROM Page ORDER BY PageCreatedDate DESC")
'Base.w("Page created : " & p.ID & " - " & p.MenuText)
'Make a copy of that node on another area:
p.AreaID = 12 'Set the area id
p.ParentPageID = 0 'Give it a parent ID that exists on that area - 0 is the root and always exists
p.ID = 0 'Set the ID to 0 to create a new record in page table - otherwise it will just override
p.MenuText = "An empty page node" 'Give the page a name... May not change?
p.Save() 'Save it to DB.
End If
End Sub
Hi,
Is there a notification for this in Dynamicweb 7? I've been trying to find it with no luck
Nuno
You must be logged in to post in the forum