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.

Template Questions /

Using variables within the CMS HTMLField


Reply


3 Posts   1051 Views

Avatar
VanceK

Community Member, 17 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;
[url]http://doc.silverstripe.org/shortcodes[/url]
[url]http://www.ssbits.com/tutorials/2010/2-4-using-short-codes-to-embed-a-youtube-video/[/url]

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

Hope that helps :)

Avatar
VanceK

Community Member, 17 Posts

14 January 2011 at 1:21pm

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

-Vance