Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|improve this question
    
Did you every figure out how to do the .js hack? If so, please share. –  user17941 Jun 27 '13 at 22:52
    
Yep - 1) create list with columns you want; 2) create HTML layout you want with placeholder elements (<span>s or <div>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. Can't be more specific sorry, don't have access to it any more! –  Beeblebrox Jun 28 '13 at 3:04
1  
@foocode please add this as an answer to make it easier for other users of the site to find this solution (assuming it is significantly different from the accepted answer). Thanks. –  SPDoctor Jun 28 '13 at 9:16
    
No probs, I'll reformat the above. –  Beeblebrox Jun 28 '13 at 14:48
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks Andrey, interesting article and I can see how that'd be applicable here. Unfortunately we're running in a strictly 'no internal dev' environment (even my XSLT is borderline) so it'd be a lot easier for me to adopt the JS approach. The control adapter tip is great though so thanks for highlighting it. –  Beeblebrox Jun 7 '12 at 5:35
add comment

@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.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.