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

Forums / Developing with Sitefinity / Change Sitefinity Content Block Value Dynamically

Change Sitefinity Content Block Value Dynamically

3 posts, 1 answered
  1. Atit
    Atit avatar
    10 posts
    Registered:
    27 Feb 2015
    10 Apr
    Link to this post

    Hi, 

    We have a CMS website where certain content is repeated on multiple pages as part of a larger content. For example website has APR displayed at different locations and each time bank rate changes, we need to change this content. As it is part of larger content block, I am unable to use Shared Content block. 

    I have 2 ideas as I understand - 
    Option 1 - Add a placeholder in content block (for example @@APR@@) and interject page rendering. If I see placeholder on current page, show current APR value. This way I can change APR value at one place and it will reflect everywhere. I am not sure how to do this or even if it is possible/advisable.
    Option 2 - Another option is to use my own custom module to house content blocks with placeholder text and then I can render my module instead of sitefinity content block on page.

    I can get option 2 to work but would prefer option 1 so that I don't have to create my own module and everything.

    Thanks for your help.
    Atit

  2. Christopher
    Christopher avatar
    3 posts
    Registered:
    05 May 2014
    10 Apr in reply to Atit
    Link to this post

    Its certainly possible. Have a look at this github repo and its accompanying youtube video for an example.

    https://github.com/timw255/Tokens

    Answered
  3. Atit
    Atit avatar
    10 posts
    Registered:
    27 Feb 2015
    11 Apr in reply to Christopher
    Link to this post

    Hi Christopher,

    This is exactly what I was looking for. Thank you very much. I believe Sitefinity should have similar functionality built right into it. It comes handy when you have some text replaced in many different places.

    If someone has trouble adding "Tokens" section to settings, global.asax.cs code should go under Application_Start() instead of Start().

    Thanks
    Atit

3 posts, 1 answered