I'm currently upgrading a SharePoint site with a custom master page from 2007 to 2010. We want to be able to let the user decide when to migrate their site from 2007 L&F to 2010 L&F using the built-in Upgrade option, so what this means is that I need the custom master page to support both UIv3 and UIv4.
I've had some luck with introducing the Ribbon code inside a UIVersionedContent (v4) element, and moving the equivalent header code inside a UIVersionedContent (v3) element. This lets me switch between UIv3 and UIv4 in the site options and go "there's a ribbon; now it's back to normal", although there are bits missing:
I've run into issues whereby I need to have a standard SharePoint ContentPlaceHolder element (e.g. PlaceHolderTitleBreadcrumb, PlaceHolderSiteName, PlaceHolderTopNavBar) inside both the v4 and v3 sections, so the content can appear whether the page is in v3 or v4 UI mode. Despite the fact that the two sections are mutually exclusive, if I do put in duplicate ContentPlaceHolders I always get a parser exception saying that the IDs of the elements aren't unique. I can't work around this by repositioning my UIVersionedContent tags around the ContentPlaceHolders, so it seems to me I can't have a custom master page that fully supports both the old and new UIs.
Example code: (probably badly formatted, I'm JS-limited here)
<SharePoint:UIVersionedContent UIVersion="4">
<ContentTemplate>
<SP ribbon code>
<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server">
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitle"><SharePoint:ProjectProperty Property="Title" runat="server" /></SharePoint:SPLinkButton>
</asp:ContentPlaceHolder>
</SP ribbon code>
</ContentTemplate>
</SharePoint:UIVersionedContent>
<SharePoint:UIVersionedContent UIVersion="3">
<ContentTemplate>
<Old custom header code>
<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server">
<!-- Causes an error as the ID is duplicated -->
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitle"><SharePoint:ProjectProperty Property="Title" runat="server" /> </SharePoint:SPLinkButton>
</asp:ContentPlaceHolder>
</Old custom header code>
</ContentTemplate>
</SharePoint:UIVersionedContent>
Is there something I've missed? Some way I can associate two ContentPlaceHolders with one bit of SharePoint's content without having duplicaet IDs? Some neat way of duplicating the content of one ContentPlaceHolder to another?
Or is there some other way I should be doing this rather than having a single master page that supports UIv3 and v4? An easy way to tell a SPWeb "If your UIVersion is 3, use this MasterUrl, but if it's 4, use this one"? A way to hook into a UIVersionChanging event and change the MasterUrl?