1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / How do I shared content across templates in Sitefinity 5?

How do I shared content across templates in Sitefinity 5?

8 posts, 1 answered
  1. Nancy
    Nancy avatar
    35 posts
    Registered:
    10 Apr 2012
    07 May 2012
    Link to this post
    I have multiple templates on a site. They all share the same footer which has content that needs to be editable by the content editor of the site. I cannot put the content in a master page because the site editor needs to be able to edit it through the WYSIWYG, but I don't want the editor to have to update it in multiple places when it needs to be updated.  I tried creating a shared content block, but apparently those are not accessible from templates unless I'm missing something. Is there a setting to turn on shared content blocks for templates? Thank you for your help.
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    07 May 2012
    Link to this post
    Nancy,

    Unfortunately I believe shared content blocks are not yet usable in templates. I know that the team is aware and looking ino this issue, I'll try to find out more and update this thread.

    however, you may be able to fix this with a Sitefintiy base template. If you create a template in Sitefinity (under the design menu) and place a content block in this template, you can then create additional templates that use this as a base.

    This way the base template will have a WYSIWYG editor, and any changes will automatically propagate to all templates that use it as a base.

    hope this is helpful, thank you for your feedback!
  3. Nancy
    Nancy avatar
    35 posts
    Registered:
    10 Apr 2012
    07 May 2012
    Link to this post
    I really wish they were available, but this will be an okay solution for this project. I can't use the same starter for my home and sub pages since they are too different, so I will still need 2 starter templates, but at least they will only have to update the footer content in 2 locations instead of multiple.
  4. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    07 May 2012
    Link to this post
    We created a widget that you can add to a template that can be used until the functionality is out-of-the-box. You can download the widget from here. Just add it to your project, re-compile, and then add it to your page controls.

    It just allows you to select a content item to be displayed on your template. You have to go to the content section to edit it your "Content block", but once edited, it will update on the template.
  5. Nancy
    Nancy avatar
    35 posts
    Registered:
    10 Apr 2012
    07 May 2012
    Link to this post
    Two more things. First, I get a 404 when I click the link to download the widget. Second, once I get it downloaded, what do I need to do to "add it to the project"? Is it just a matter of putting the file(s) in a certain folder or do I need to edit a config file as well? I do have Visual Studio and I know where the build button is but that is about as far as my knowledge goes. I am learning as I go on this project.  Feel free to point me to documentation for this. I am new to Sitefinity and .net so I don't know all of this. Thanks again for your help.
  6. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    07 May 2012
    Link to this post
    I apologize for the link. Most of the time, chrome copies the protocol also. (link updated)

    As for where to put the archived folder, that is up to you. We keep all of our internal widgets in a "Widgets" folder on the root of the site. Once you have the folder extracted, open up your project. Then, with the "Show All Files" set, right click on the new folder and include it in your project. Then you should just be able to build your project. There is an icon next to the "Refresh" icon above your solution explorer. Here is a link to a site that has an image of the icon.

    As for registering the control, you need to follow this document to add to the "PageControls". Below are the only values you need to enter for the fields that match the image at step 5:
    ControlType: ~/Widgets/SharedContent/SharedContentWidget.ascx
    Name: SharedContent
    Title: Shared Content
    Description: Control to display a content block on the site.
    LayoutTemplate: (leave blank)
    VisibilityMode: None

    The control type assumes that you have extracted the SharedContent folder in a folder called Widgets. This folder would be in the root of the site files. I attached a screen shot of the settings section with the widget already registered.

    Once the widget is registered, you can then just navigate to your page template and you should have a "Shared Content" widget under the content section on the right. If you created a new section then it will be under that new section rather than the "Content" section. If you do not see the widget then you might need to reset your site. You can do this by making a fake edit to your web.config file. (Just delete a character and then type it back. Then save the file)

    I hope this helps you out.
    Answered
  7. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    07 May 2012
    Link to this post
    Richard, thank you for sharing this solution and for your help with this thread!

    I just wanted to add a quick shout-out for Sitefinity Thunder: http://www.sitefinity.com/sitefinity-thunder

    Nancy, if you're new to Sitefinity, the Thunder visual studio extension helps minimize the guesswork. It has a feature to quickly register widgets in your solution into the toolbox and lots of other time savers and helpers.

    For a more thorough walkthrough be sure to check out the recording of the recent webinar on thunder: http://www.sitefinity.com/blogs/joshmorales/posts/12-04-19/sitefinity_thunder_webinar_notes.aspx
  8. Nancy
    Nancy avatar
    35 posts
    Registered:
    10 Apr 2012
    08 May 2012
    Link to this post
    Thank you so much. this is exactly what we needed. I really appreciate your help and you quick response time. I will take a look at Sitefinity Thunder as well.
8 posts, 1 answered