Question

We want to create sites based on a site template that we're defining. We are planning on including a hidden list (containing only 1 row) with structured metadata related to that site i.e. a columns for 'codename', 'project leader', 'executive summary' etc.

As part of this template, I'd like to provide some standard content on the site homepage within a Content Editor WebPart and within this content I'd like to reference the metadata. For example;

[Content Editor WebPart]
  <h1>{metalist.codename}</h1>
  <h2>{metalist.codename}</h2>
  <p>{metalist.execsummary}</p>
[/Content Editor WebPart]

Is it possible to do this with default SharePoint or SharePoint Designer 2010 functionality?

If so, how?

I have been looking in SPD2010 as I thought I would be able to define the metadata list as a DataSource and then include references to those fields. I haven't found that trick yet (if it's in there).

My other (less-desirable) plan was to include JS which retrieves the metadata row via a list service call and then does a text replace on the page content.

Thanks!

Was it helpful?

Solution

I'm afraid it is not possible with SPD. The only way would be to create a JS hack as you mentioned above.

Instead, I would suggest considering Control Adapters approach. It is described in the following blog post by SharePoint Server MVP Waldek Mastykarz:

In brief, you should create ControlAdapter for the ContentEditorWebPart class, then create .browsers file, and then place this file into App_Browsers folder inside your IIS Web Application folder (where the web.config file is stored).

It will involve some very basic programming skills, but the code is supposed to be very simple. If you will have any difficulties with it, please let me know.

I've implemented ControlAdapter for ContentEditorWebPart myself, for localization purposes, and it works great.

OTHER TIPS

@jeff, here's an overview of the JS method:

  1. Create list with columns you want;
  2. Create HTML layout you want with placeholder elements (s or s), upload as a file;
  3. Use the uploaded HTML snippet as the content source for a ContentEditorWebPart on the page you want;
  4. Create a JQuery snippet to call the list's webservice and retrieve the row data, then add the values in to the HTML placeholder elements (might want to check out SPServices for this too);
  5. Add another ContentEditorWebPart using the JS snippet as it's content source.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top