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

Add This Code


Go to End


6 Posts   1378 Views

Avatar
Lemonie

Community Member, 70 Posts

4 October 2012 at 7:14am

I am trying to add the following 'add this' code to my website but it isn't showing. Have tried putting it in <p></p> which has worked with other codes in the past?

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_email"></a>
<a class="addthis_button_print"></a>
<a class="addthis_button_compact"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-506c7b45025956c0"></script>
<!-- AddThis Button END -->

Avatar
Nobrainer Web

Community Member, 138 Posts

4 October 2012 at 9:57am

a little info about where you add the code and such, would be helpfull.

remember to add ?flush=1 to the URL when making changes to template files - this forces SS not to use cached files.

Avatar
Lemonie

Community Member, 70 Posts

4 October 2012 at 10:03am

Hi

I want to add this directly to a web page.

Thanks

Avatar
Nobrainer Web

Community Member, 138 Posts

4 October 2012 at 10:07am

If you are trying to add the code in the TinyMCE editor, i guess the script tags will be stripped out.
Try having a look at the source code, what is actually coming out from the editor.

I think you should add the code to your template file instead.

Another option is to create a simple Textarea (without editor) and output the in the template.

Avatar
Neelam

Community Member, 15 Posts

6 October 2012 at 8:04pm

Edited: 06/10/2012 8:06pm

But tinymce can be configured to allow script as well right....?? I have tried it by adding HtmlEditorConfig::get('cms')->setOptions(array(
'extended_valid_elements' => "*

  • "
    ));

    to mysite/_config.php...but script tags are getting stripped...any idea where this is happening?

Avatar
edwardlewis

Community Member, 33 Posts

12 October 2012 at 1:01pm

I would create a new text area field and drop the code in there.. or put it directly into the page template