Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

Using variables within the CMS HTMLField


Go to End


3 Posts   1955 Views

Avatar
VanceK

Community Member, 18 Posts

14 January 2011 at 6:04am

Is is possible to enter a $SiteConfig variable within the text entered in the Content field of the CMS that will display that variable's value when the page is generated? I know how to use the variables in a template, but I wish to insert variables within the content itself.

Thanks for any help that is offered.

Vance

Avatar
Howard

Community Member, 215 Posts

14 January 2011 at 11:49am

Hey there welcome to SilverStripe.

Yea there a few ways to do it - best option is to use a shortcode, see;
http://doc.silverstripe.org/shortcodes
http://www.ssbits.com/tutorials/2010/2-4-using-short-codes-to-embed-a-youtube-video/

You may find that's not quite what you're after and might want to try this:
http://doc.silverstripe.org/recipes:customising-content-in-your-templates

Hope that helps :)

Avatar
VanceK

Community Member, 18 Posts

14 January 2011 at 1:21pm

Beautiful, Howard! Works like a charm! Thank you so much!

-Vance