I’ve been meaning to write about this for a while – how to programmatically disable page layouts for a site in SharePoint, similar to how you’d do so with the ‘Page Layouts and Site Templates’ page in the site settings. You can also specify what page layouts are allowed, if you are defining your own Site Definition. But someday, maybe you’ll have to do it through code.
I’m pretty sure that I read something that set me going on this, but I’ve lost the link 😦 Continue reading “Programmatically disable page layouts”
I had an interesting problem recently with a Site Definition. I was trying to create a publishing page, which would not create as the correct content type. I still haven’t got to the bottom of why.
However, time was limited, and we were going to have to create a feature receiver to staple to our site definition anyway, so I had a look at creating a publishing page programmatically.
We needed a feature receiver as the customer wanted the home page of their site to have a ‘Search Box’ which would ‘Search this site’, but go to a custom results page in a Search Center. My plan was to use a Search Box Web part, configured to go to a custom results page, and to append the query term:
site: [url to site]
Naturally, you don’t know the URL of the site until the site has been created – so this web part would have to be created programmatically. Continue reading “Programmatically create pages – and Add Web Parts”
So, might not be news, but SharePoint’s out of box Page Layouts suck. I’ve already described how the page layouts have an image on branding, introducing styles to change the navigation, etc.. This has led me to the conclusion that you shouldn’t use the out-of-box publishing sites – start from a minimal publishing site, and build from the ground up.
But what of customers who have naively thought that, I don’t know, a Collaboration Site Template might be a good template to use for the collaboration site? Well, this is the problem I’ve got now; a customer has used the out-of-box page layouts extensively, and now wants the styles of the text and so on to be consistent. How can I do that? Continue reading “Out-of-Box Publishing Page layouts suck too”
Aka “CAML is the bastard spawn of Satan”.
So, I’m writing a site definition to create a Publishing site. This is a bit of a first for me. One of the things I want to do is deploy a new Publishing Page Content type, and associate some layouts with it.
I started by following Andrew Connell’s instructions for a Minimal Site Definition (as in his book). This all seemed to go pretty well; testing created a new, minimal site.
Next up I wanted to deploy the Content Type and associated page layouts. Well, there wasn’t much information in his book on this – like him, I’d figured I’d write a separate Feature for deploying just the content type and page layouts – but there was very little information in his book about this. Continue reading “Deploy Publishing Pages and Content Types as a feature”
So, one of our customers is really keen that the new Page Layouts I’m writing show the page’s contact on the page. For those of you who perhaps haven’t had need to use this, the Contact field is a standard field on Publishing Pages (i.e. the Page content type). You can interact with it via the page settings:
… which shows a page with…
These fields are to allow you to select another SharePoint user, or manually enter someone’s details (if they’re not a SharePoint user!) Further, these fields are available in SharePoint designer:
So this looks like it’s shaping up to be a very brief blog post. Open up SharePoint designer, edit the page layout, drag the Contact field onto the page. With that, we get:
Great! Well, no, there are two problems with that…
Continue reading “Show a Page's Contact and Picture on a Publishing Page”
Another thing on my long list of ‘things to do’ was have a look at the RadEditor control. Well, one of the guys at the SUGUK meeting last week finally gave me an excuse – he told me that it would detect if MS Word Formatted text was being pasted into it. Now that would be cool; all our customers have problems with users pasting Word formatted text directly into MOSS. Hell, we even had this problem with MCMS – some users insisted on writing every in Word, and copying and pasting text across
So although I might be the last dev on earth to do so, I thought I’d take a look. And I was impressed. Continue reading “Finally Looked at RadEditor…”
I was reading Andrew Connell’s book ‘SharePoint 2007 Web Content Management‘ and it made something crystallize for me. I’ve been pondering this for about 8 months or so, but I believe that several of our customers are using the Publishing features of MOSS incorrectly, and that simply basing sites on out-of-box Collaboration and Publishing site templates is a mistake.
(Well, at least without additional planning) Continue reading “Plan Your Publishing Pages”