Who’s the Man Blog


HowTo: Adding an editable footer to Sharepoint
May 16, 2009, 3:18 am
Filed under: Uncategorized

 As I have worked with Sharepoint project I tried to ensure one thing: that a user should be able to customize and update any image, text, etc from within the browser easily. Well, What isn’t available for editing in the browser pretty much nothing. But do you want a end user updating something in a master page. For example if you created a footer globally in a master page and applied it across all sites do you want a end user coming in and trying to edit the one page that can break the entire site? Answer add a web part to a master page specifically a dataview webpart like in http://whostheman.wordpress.com/2009/05/09/adding-customized-webparts-to-masterpage/ . By linking this to a list it will allow a end user to update using the Sharepoint list item. To begin create a custom list by going to Site Actions -> Create and choosing Custom List call it Footer. Once that is done create

 a column called Body

 column for footer

Now create a new list item:

listitem

Now comes the interesting part open up Sharepoint Designer (the best free CMS designing tool I’ve found) and open your master page.

Find the very bottom of your page I recommend following the table tags for instance the ms-main table add the following after the last </TR> tag:

<tr><td><div class=”footer”>TEST</div></td></tr>

edt master page

Now we can insert the data view web part click in the table row where the word test appears: Insert->Sharepoint Controls->Data View. This will open the data sources library pane to the right hand right of the screen. Right click the footer list to the right and select Show Data. Drag the Body row into the web part. It should look like this:

added body row

Now right click the left hand side where is says Body choose Delete->Delete Columns. This should should make your footer text the only column shown. Go into the code view windows and got the following line <xsl:value-of select=”@Body” disable-output-escaping=”yes” /></td> and delete the class and width tag above this line in the TD tag. Select the body area and right click and choose Format Item as->Rich Text.  The last thing is to add a peice of code to ensure the webpart displays properly on subsites:

<WebPartPages:DataFormParameter ParameterKey=”WebURL” PropertyName=”ParameterValues” DefaultValue=”/” Name=”WebURL”></WebPartPages:DataFormParameter>

This needs to be added before each of the following:

</SelectParameters>

</DeleteParameters>

</UpdateParameters>

</InsertParameters>

 

and delete the word test we added in the beginning,

 

You should be able to save andhave something that looks like this, remember that it can be completely stylized with the footer CSS tag:

footerfinal


No Comments Yet so far
Leave a comment



Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>