When I create a custom page for SharePoint or indeed any custom branding, I like the minimalist approach. That is a strip out all the OOTB stuff and go back to the minimum I can get away with. Only this time when I stripped this particular page/masterpage back I ended up with the javascript error “Pub is Undefined”. Well in fact I didn’t see that error until I used the F12 tools in IE. The symptoms were that the page just would not switch to Edit mode unless I called the action from the main “Site Actions” menu. Using the “Edit” button on the menu didn’t work. Had to be a javascript error for sure I thought. So I just got out the V4 masterpage and began stripping back again until I came to this well known Delegate Control:
<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole" Id="PublishingConsoleDelegate" />
Which seemed to be the culprit. No actual Publishing console appears in SharePoint 2010. It’s all in the Ribbon. But I guess some little leftover from 2007 seems to require this to work fully. I guess it just forces the loading of the SP.UI.Pub.Ribbon.js which seemed to be the missing file. So there you go, another solution to the mysterious “Pub is undefined” error when building hghly customized SharePoint pages which use the Publishing Features… you still need the above control for everything to work smoothly.
Cheers
Dave Mc






Leave a reply to MartinB Cancel reply