Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Typing variables in the cms editor

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1442 Views
  • heidgert
    Avatar
    Community Member
    16 Posts

    Typing variables in the cms editor Link to this post

    Is there any way to allow an editor to type a variable name into the TinyMCE editor content field and have Silverstripe parsing it from a function in my page controller?

    For example:

    * I have a function called VersionNumber in my Page_Controller class which fetches a products name and version number from some location and returns it. I also have a function named ReleaseDate which (yes) fetches and returns the ReleaseDate.

    * An editor types "The most recent release is $VersionNumber which was released $ReleaseDate".

    I want editors to be able to use the $VersionNumber and $ReleaseDate throughout the entire site so avoid manually updating something like this on several locations.

    Is this possible? I've tried a few different things but haven't managed (the string $VersionNumber is written out in plain text).

  • Howard
    Avatar
    Community Member
    215 Posts
  • heidgert
    Avatar
    Community Member
    16 Posts

    Re: Typing variables in the cms editor Link to this post

    Yay! Works like a charm. I've been searching for this without realizing there was a recipe about this.

    Thanks!

    1442 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.