Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kasper Dyrvig 246 posts 379 karma points
    Sep 07, 2010 @ 17:23
    Kasper Dyrvig
    0

    AddThis <script> problem

    I would like to use the great sharing function that AddThis.com provides. But when I paste the script part:

    <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4c865497073ebbd7"></script>

    on the template get 6 extra share buttons on random places.

    If I place the script in the XSLT file the browser reads until the script and stops. The bottom of the site is not showing.

    Does anyone know how to pull this off currectly? I'm using Umbraco 4.5.1.

  • Kasper Dyrvig 246 posts 379 karma points
    Sep 07, 2010 @ 17:42
    Kasper Dyrvig
    0

    Well, I got rid of the extra share buttons by adding &nbsp; in the final share link...

  • Hendrik Jan 71 posts 137 karma points
    Sep 07, 2010 @ 23:21
    Hendrik Jan
    0

    Xslt's output is by default xml. so it wil close empty xml tags:

    <script></script> becomes <script />

    You browser wont like this and your page wil die


    more info in the wiki
    http://our.umbraco.org/wiki/how-tos/xslt-useful-tips-and-snippets/stop-html-tags-from-self-closing

  • Dwayne A 97 posts 117 karma points
    Feb 14, 2011 @ 09:25
    Dwayne A
    0

    Hi all. I had a simillar issue, but in my case I could get the "share" hypertext to render, but all icons were missing.

    I then followed ALL suggested methods here our.umbraco.org/.../stop-html-tags-from-self-closing, but this caused the problem described by the original poster, Webspas. It seems the icons iterated and were spit out randomly.

    Finally I foolowed his last suggestion and placed a &nbsp; in the last A tag, and all seems to work fine.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 14, 2011 @ 09:42
    Jan Skovgaard
    0

    Hi guys

    What are your reasons for placing this script in a XSLT file instead of in the <head> section or right before the closing </body> tag in the master template?

    If you really need to insert it into a XSLT file I guess this should be possible to do like this

    <xsl:text disable-output-escaping="yes"><![CDATA[<script src="pathtoscript"></script>]]></xsl:text>

    Cheers

    /Jan

  • Dwayne A 97 posts 117 karma points
    Feb 14, 2011 @ 10:34
    Dwayne A
    0

    @ Jan Skovgaard: I attempted to place the script directly in my master template with the same negative results. Therefore I created a macro. Either way, it renders poorly without the hack.

  • Dwayne A 97 posts 117 karma points
    Feb 14, 2011 @ 10:36
    Dwayne A
    0

    @ Jan Skovgaard: I attempted to place the script directly in my master template with the same negative results. Therefore I created a macro. Either way, it renders poorly without the hack. By the way, I am having problems with the JavaScript link, not a span tag. I attempted the method you describe, but not until adding a non-breaking space to my last a tag did the browser render properly.

  • Dwayne A 97 posts 117 karma points
    Feb 14, 2011 @ 13:14
    Dwayne A
    0

    I have now placed addthis directly in the template without a macro and it does work. But only when the &nbsp; is in place as described above.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 14, 2011 @ 18:26
    Jan Skovgaard
    0

    Hi Dwayne

    Happy to hear you got it solved by placing the script in the template. I had a hard time to figure out why the </script> would be removed when placing it there...so it turns out that it does'nt :-)

    /Jan

  • Dwayne A 97 posts 117 karma points
    Feb 14, 2011 @ 23:20
    Dwayne A
    0

    @Jan: I'm running 4.6.1. Whiich version did you experince that problem with? Are you saying the </script> tag disappeared from your page when placing it in the template?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 15, 2011 @ 08:10
    Jan Skovgaard
    0

    Hi Dwayne

    No I have not experienced the problem when inserting it directly in the template, but you wrote you experienced the problem when inserting it directly in your master template in a previous post. That was got me a bit puzzled - but you got it working know and that's what matters :-)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft