SharePoint content editor web parts — now it’s starting to make sense
Today I had one of those ‘Eureka!’ moments where a whole lot of disconnected information suddenly fell into place. Good feeling.
As a self-taught SharePoint user, there are big gaps in my knowledge, and the worst thing is that much of the time I don’t know what I don’t know.
I also dabble a bit more in the technical details than the average SharePoint end user, but I’m not a developer. I haven’t coded (as a job) in a very long time, so while I can understand the concepts I definitely couldn’t sit down and write web parts using .NET without a lot of upskilling.
I am moderately comfortable with Javascript, however.
I dip in and out of the Microsoft SharePoint sites. Each time I understand a little more. Today I decided to take another look at the Hello World Custom Menu Web Part.
This rather nifty little example shows you how to add a menu item to the Edit menu for documents in a document library. The example they start with displays a “Hello World” dialog box, but then they go on to show how to use the same process to add a “send an email link”, which emails a link to the document you are currently looking at.
Cool.
So, how do they do it?
They add a content editor web part, put some Javascript into it, and then hide it. The Javascript adds the menu option to the document library, which is another web part on the same page.
That’s when I had the Eureka moment.
A content editor web part isn’t just for adding text.
I have only ever used content editor web parts to add text up to now. Admittedly, I have embedded Javascript in that text sometimes, but the Javascript has always been specific to that particular web part. Simple little things like a date countdown displayed on the page, or mouseover functionality.
Now I suddenly realised that the Javascript I add to that content editor web part can be used to affect other parts of the page. And I remembered, then, an experiment I tried with inline styles early on in my SharePoint life. An experiment I stopped abruptly because the styles in that particular web part impacted the rest of the page. I didn’t understand why at the time, and didn’t follow it through. Now I understand. It’s not just Javascript that I can use. It’s any content (within reason) that can be added to a web page.
It’s so simple. So obvious. Now it’s starting to make sense.
Comments (2 comments)
Do you use Sharepoint Portal Server 2007? We’re about to upgrade to that, and am curious if you have any experience using the blog, wiki, rss, knowledge network, and other features it provides.
Tom Johnson / January 25th, 2007, 11:17 pm / #
Tom
Unfortunately we’re still on 2003, and not likely to upgrade in the next 12 months. I envy you that you’re doing it. There are some lovely features in 2007 especially the blogs, wiki and the knowledge network.
I haven’t use 2007, I have only seen the demos. Have you seen the video over at MSDN Channel 9 ( http://channel9.msdn.com/Showpost.aspx?postid=208577)?
CabSav / January 27th, 2007, 5:00 pm / #
Post a comment