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.

General Questions

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

Add This Code


Reply

6 Posts   550 Views

Avatar
Lemonie

4 October 2012 at 7:14am Community Member, 70 Posts

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

4 October 2012 at 9:57am Community Member, 135 Posts

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

4 October 2012 at 10:03am Community Member, 70 Posts

Hi

I want to add this directly to a web page.

Thanks

Avatar
Nobrainer Web

4 October 2012 at 10:07am Community Member, 135 Posts

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

6 October 2012 at 8:04pm (Last edited: 6 October 2012 8:06pm), Community Member, 15 Posts

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

12 October 2012 at 1:01pm Community Member, 32 Posts

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