Since Custom page providers is the coolest in EPiServer since the first steps towards objects in EPiServer 3.40, I thought I would demonstrate a few ways of using Page Providers with Extension X3.
Prerequisites
First of, Page Providers is a new Feature in EPiServer CMS 5 R2, so you need one of them. Second, Page Providers are only availible with a Enterprise license, so you need one of them too. You can order one by saying "Give me an Enterprise license" in the Comment field when ordering a developer license.
All codesamples in this post uses the XML provider witch can be downloaded here: http://world.episerver.com/en/Articles/Items/Introducing-Page-Providers/
Introduction
So far, I can think of three ways you can use Custom Page Providers with Extension X3. I will give a short description here. Please note, this is in many ways a conceptual post. Two of the three ways doesn't work right now but might work with upcoming releases of Extension X3 and EPiServer CMS.
Fetch Extension X3 to
This is when you build a page similar to "Extension Templates" and use it as the base for the provided pages and you just add a fex EPiServer properties that you can populate from your provider. The problem with this variant is that the content from Extension X3 is rather static, but at least you can change the information in one place and it will be updated on all provided pages.
Fetch provider page as function
This is when you provide all your pages as a function in Extension X3 and you then fetch the data to your real functions. The problem with this way is that if you get a lot of provided pages, there will be a really hard work to make all them functions on the real pages. But if you only have a few, this might be the best way.
Store Extension X3 data in the Page Provider
This is the most integrational method. You simply store all or some Extension X3 data in your custom Page Provider. You simply need to handle the special Extension X3 properties. This can be very useful if you need to have different content on different Provided pages. The downside of this method is that all your provided pages will have no Extension Data as a start or you can set some default values, but then you can't update your default values in a safe manner. A solution for this problem is already added as a feature request in Extension X3 and will hopefully be added in a near future.
Fetch Extension X3 to
So, I have created an Extension X3 pagetype with a normal property, "MainBody", that I will populate with data from the Page Provider.
I then create a normal Extension X3 page with a few functions on it:
And then I add my provider, heres the XML:
1: <pages>
2: <page id="10000"
3: parent="0"
4: pagetypeid="18"
5: versionid="1"
6: security="Everyone:Read">
7: <property name="PageGUID">35a988fe-2bc1-4e45-a41f-3a009a660552</property>
8: <property name="PageTypeID">18</property>
9: <property name="PageWorkStatus">4</property>
10: <property name="PageFolderID">118</property>
11: <property name="PageTypeName">[ExtensionSys] Extension</property>
12: <property name="PageMasterLanguageBranch">en</property>
13: <property name="PageLanguageBranch">en</property>
14: <property name="PageName">XML Page Provider page</property>
15: <property name="PageStartPublish">05/20/2008 09:06:00</property>
16: <property name="PageVisibleInMenu">True</property>
17: <property name="PageCreated">05/20/2008 09:06:00</property>
18: <property name="PageChildOrderRule">1</property>
19: <property name="PagePeerOrder">100</property>
20: <property name="PageURLSegment">XML-Page-Provider-page</property>
21: <property name="PageShortcutType">4</property>
22: <property name="PageShortcutLink">41</property>
23: <property name="PageLinkURL">/templates/extension.aspx</property>
24: <property name="Heading">A subpage</property>
25: <property name="MainBody"><p>MainBody From XML Page Provider page</p></property>
26: <property name="SecondaryBody"><p>second body</p></property>
27: <property name="MetaAuthor">John Doe</property>
28: </page>
29: </pages>
On row 8, is the extension pagetype and row 21 and 22 says "Fetch Data From my source page" I just created. I then overwrite my MainBody with row 25 and the result looks like this:
Fetch provider page as function
As of today, there are no easy way of displaying any more EPiServer built in properties other than the ones who are already displayed. But that doesn't really matter since EPiServers throws an error when you try and fetch data from a provided page. Hopefully, both errors can be fixed in the next versions of Extension X3 and EPiServer.
Store Extension X3 data in the Page Provider
This method is not avalible today as the Extension X3 GUI is a bit buggy. It will be corrected in a coming version of Extension X3 though.
Conclusion
Today, you might not be able to do everything you want to do with Page Providers in Extension X3, but you can hopefully see the potential. It's the same with Page Providers in EPiServer CMS. My guess is that it will take up to a year before we as a community really starts to use it to the fullest. It is a really cool technologie that will really push EPiServer CMS, and Extension X3, to the next level of Enterprise solutions.