It is a best practice to limit the number of Pages Types an editor can choose from when the editor creates a new page.
As you probably know this is configured in Admin Mode on each Page Type. What you probably don’t think about is that these settings can make it impossible to import and export pages.
“Available Page Types”-rules can break import
If your rules change over time or if you use Stop Publish and Archive Page so your pages moves around you can get in trouble with these rules.
In the current version (5.1.422.122 SP1) the import will stop with an error and it can be quite hard to figure out what is wrong.
I created a SQL-statement to help you figure out what is wrong. It will give you a list of all pages breaking the “Available Page Types”-rules. It lists the Parent and Child’s Page Id, Page Name and also Page Type.
This (messy) SQL statement for copy paste:
SELECT fkParentID AS ParentPageId, pkID AS ChildPageId, (SELECT Name FROM tblPage AS p2 WHERE (pkID = p.fkParentID)) AS ParentPageName, Name AS ChildPageName, (SELECT fkPageTypeID FROM tblPage AS p2 WHERE (pkID = p.fkParentID)) AS ParentPageTypeId, fkPageTypeID AS ChildPageTypeId FROM tblPage AS p WHERE (NOT EXISTS (SELECT fkPageTypeParentID, fkPageTypeChildID, Access FROM tblPageTypeToPageType AS tt WHERE (fkPageTypeParentID = (SELECT fkPageTypeID FROM tblPage AS p2 WHERE (pkID = p.fkParentID))) AND (fkPageTypeChildID = p.fkPageTypeID))) AND EXISTS (SELECT fkPageTypeParentID, fkPageTypeChildID, Access FROM tblPageTypeToPageType AS tt WHERE (fkPageTypeParentID = (SELECT fkPageTypeID FROM tblPage AS p2 WHERE (pkID = p.fkParentID))))
Tags: Available Page Types, EPiServer, EPiServer 4, EPiServer 5, Export, Import
-
hej Fredrik,
Finns det ett sätt att kunna bestämma vilken sidtyp som skall visas för en specifik sida beroende på den aktuella sidans förrällder via kod kanske?
Ett exempel:
Jag befinner mig under en del av ett sträd och jag skapar en lista, listsidtypen säger att jag bara kan skapa en specifik sidtyp under denna vilket är ok men under en annan del av trädet vill jag använda mig utav samma sidtyp för att skapa en lista och jag vill att denna sidtyp (som är samma som i andra delen av trädet) visar andra sidtyper jag kan skapa under den. Allt detta skall bero inte på den aktuella sidtypen jag skapar sidan under utan på dess förällder.
Tack på förhand
Diego Delfino -
Hi Fredrik,
I have managed to come up to a partial solution and would much apreciate your guidence in the following steps.
I have now created a property for the page i want to use as a container, this page gets the systems available parent types from a list in the web.config file. I would need some suggestion if you have to override the code that corresponds to tha determination of witch page types to make available for a page type and by this just comparing the parent type with the one the admin has defined in the page three.
any suggestions?
best reegards
Diego Delfino -
Hi fredrik,
I have been thinking of your last suggestion and it looks like it may be the only answer, I do fear a little that the Database calls would increasy conciderably becasue of calls to check that state on every page type created. It is by far the best suggestion I have heard yet. I was also looking into the PageType class and hopping to change the outcome of every page from there but that seems to only make it worse and i don’t beleive in that straight.
keep you posted on my progress
Diego

![Fredrik Haglund [Photo by: Kristina Sahlén]](http://blog.fredrikhaglund.se/wp-content/uploads/2010/03/fredrik200.jpg)

5 comments
Comments feed for this article
Trackback link: http://blog.fredrikhaglund.se/blog/2008/03/20/available-page-types-in-episerver/trackback/