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

Forums / Developing with Sitefinity / Can I use tokens inside of shared content?

Can I use tokens inside of shared content?

5 posts, 0 answered
  1. Bart Welch
    Bart Welch avatar
    64 posts
    Registered:
    10 Jul 2009
    30 Sep 2009
    Link to this post

    We are currently developing our new site in Sitefinity and to make it easier to use various legal names across our entire site, can we use a token for a product name inside of shared content module?  In other words, we have a product name that I want to use as a shared content module nested inside another shared content module.  This way, if we ever change to product name, it will change the name throughout our web site without having to change all of the shared content modules that contain that name.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    30 Sep 2009
    Link to this post
    Hi Bart Welch,

    It could be done. Your project should use the same database - or at least the provider for desired module should share the same database as this one in the other project. Thus when a change is made to one of your projects this will affect all connected websites. This applies to all operations - renaming, deleting, creating, modifying.

    As you can see from the declaration below, each provider has a connectionString attribute that can be used to connect the provider to different instances.

    <add name="Generic_Content" urlRewriteFormat="[Publication_Date]/[Name].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="True" defaultMetaField="Name" securityProviderName="" allowLocalization="False" allowVersioning="True" allowWorkflow="False" allowComments="true" commentsModeration="true" versioningProviderName="" connectionStringName="GenericContentConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data"/> 

    Note that the applicationName should be the same when you want to share content. I hope this helps.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Bart Welch
    Bart Welch avatar
    64 posts
    Registered:
    10 Jul 2009
    30 Sep 2009
    Link to this post
    Here is a better example of what I need.  The bold, italicized text below is what I need to use as a seperate shared content item that I may need to change in the future accross the entire web site.

    Lobortis wisi et dolore lobortis, magna enim consequat, volutpat velit consequat iriure sed wisi. Et odio duis vel commodo in accumsan vulputate illum molestie, LEGAL NAME HERE ut duis duis ut, ullamcorper, nulla nostrud tation blandit enim, dolore vero odio amet. Qui nisl in nostrud consequat iusto, eum, suscipit autem vero wisi, dolore exerci ut erat facilisis magna. Ut nulla duis amet autem, augue, et zzril delenit, ut dignissim at in esse. Molestie vulputate, te nonummy luptatum ex zzril esse duis minim. Dolor, iusto volutpat zzril nulla quis eum vero vel vel hendrerit vulputate. Consectetuer dolor exerci ea feugiat nulla molestie minim nonummy nulla dolore tincidunt consectetuer dolore nulla lorem ea ut at.

    Let's say next year rolls around and I want to change 'Legal name here' to 'different legal name' by just changing one peice of shared content.
  4. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    30 Sep 2009
    Link to this post
    Hey Bart,

    Sounds like you're looking for nested generic content.  In other words, a Generic Content item that contains a shared Generic Content item.  However, I also understand the end-goal is to easily change a product name, site-wide.

    Just a random thought, Georgi Chokov created an awesome ReplaceTool for Sitefinity.  This tool can be used to globally replace text throughout the web site.  The tool accepts regular expressions and I've used it a lot to quickly handle site-wide text swaps.

    http://www.sitefinity.com/blogs/georgichokov/posts/08-12-15/replacetool_-_globally_replace_everything_in_your_project_with_zero_efforts.aspx

    http://www.sitefinity.com/support/code-library/sitefnity/tools/replacetool.aspx

    I'm not sure if this would be helpful in your ciricumstance.  This isn't nested Generic Content, but it does make it easy to change a product name site-wide.  Let me know your thoughts.

    Cheers.
  5. Bart Welch
    Bart Welch avatar
    64 posts
    Registered:
    10 Jul 2009
    30 Sep 2009
    Link to this post
    Yes, it would be using nested shared content inside of another content module.  I'll take a look at the replace tool to see if it will benefit us. 
Register for webinar
5 posts, 0 answered