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.

General Questions /

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

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

Inserting HTML block into page content


Go to End


4 Posts   2365 Views

Avatar
Sadu

Community Member, 5 Posts

4 November 2009 at 7:48am

Hi All,

I would like to insert a HTML snippet / content from a template file into a page - but without having it mangled by the WYSIWYG.

In this case it's a block of HTML for signing up to a newsletter provided by a 3rd party. It makes sense to keep this code in a template, away from prying hands.

Is there a way to place a marker in the content editor which will get str_replaced with the actual HTML content later on at display time?

I could mangle a solution together but I'm half expecting this functionality to exist somewhere so thought I would ask.

Cheers,

Harvey.

Avatar
Willr

Forum Moderator, 5523 Posts

4 November 2009 at 1:18pm

Currently one of the ways to do that would be to do something like http://doc.silverstripe.org/doku.php?id=recipes:customising-content-in-your-templates. In the upcoming 2.4 release, it has a neat little tokenized system for inserting snippets into the content area which is a bit nicer then a str_replace.

Avatar
Sadu

Community Member, 5 Posts

5 November 2009 at 10:46am

OK, that worked, thanks. Appreciate the prompt response too :)

Avatar
brisrocket

Community Member, 2 Posts

31 July 2013 at 4:25pm

Really old post (I know) but the link is dead and the question is not answered anywhere else. I'm trying to embed html using the insert html function, like this:
<div id="surveyMonkeyInfo"><div><script src="https://www.surveymonkey.com/jsEmbed.aspx?sm=xxxxxxxxxxxxxx"> </script></div>Create your free online surveys with <a href="https://www.surveymonkey.com/">SurveyMonkey</a> , the world's leading questionnaire tool.</div>

This is SurveyMonkey's latest embed functionality. Hopefully Silverstripe can support this.