November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi Paul,
you can attach an event to DataFactory.CreatedPage and in that event you check if the page created is of Page Type X, if it is, then create new pages as you please. If you're using EPiServer 6 you can use the code below. Otherwise, just make a HttpModule and do the "same" thing. If you are using PageTypeBuilder you can check if it is the correct page type by "if (e.Page != null && e.Page is PageTypeXClass)"
[EPiServer.Framework.InitializableModule]
public class PageEventsModule : EPiServer.Framework.IInitializableModule
{
private bool _isInitialized = false;
public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)
{
if (!_isInitialized)
{
DataFactory.Instance.CreatedPage += new PageEventHandler(Instance_CreatedPage);
_isInitialized = true;
}
}
void Instance_CreatedPage(object sender, PageEventArgs e)
{
if (e.Page != null && e.Page.PageTypeName == "PageTypeX")
{
CreatePageMethod(e.PageLink, "PageTypeA");
CreatePageMethod(e.PageLink, "PageTypeB");
}
}
public void Preload(string[] parameters)
{
throw new NotImplementedException();
}
public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context)
{
throw new NotImplementedException();
}
}
Hi all,
I'm putting together a new set of functionality for one of our sites, and would like to make the content easier to create for the users.
What I want to be able to do is, when an instance of Page Type X is created, I want to be able to automatically create Page Types A and B underneath it, ready for the user to fill in the content, without having to worry about the correct page structure.
Could anyone tell me if it is possible to do this, and if so, any pointers as to how to actually do it?
Many thanks,
Paul