Page 1 of 1

Google+ Share Button einfügen

Posted: Wed Apr 25, 2012 1:22 pm
by milos27
Habe versucht den Google+ Share Button Code in die entries.tpl einzufügen bekomme allerdings eine Fehlermeldungen. Die anderen Buttons wie Facebook und co. habe ich auch in der entries.tpl Datei aber mit dem neuen Google+ Share Button funzt es nicht...

Hier der Code:

Code: Select all

<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share" data-annotation="vertical-bubble" data-height="60"></div>

<!-- Place this tag after the last share tag. -->
<script type="text/javascript">
  window.___gcfg = {lang: 'de', parsetags: 'onload'};

  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>
Und diese Fehlermeldung erhalte ich:

Fatal error: Smarty error: [in file:/is/htdocs/wp1030605_IPSIFP7Z5U/www/trendlupe/templates/kinetic/entries.tpl line 237]: syntax error: unrecognized tag: lang: 'de', parsetags: 'onload' (Smarty_Compiler.class.php, line 446) in /is/htdocs/wp1030605_IPSIFP7Z5U/www/trendlupe/bundled-libs/Smarty/libs/Smarty.class.php on line 1093

Re: Google+ Share Button einfügen

Posted: Wed Apr 25, 2012 1:31 pm
by Timbalu
Du musst Smarty anweisen die geschweiften Klammern unberücksicht zu lassen

Code: Select all

{literal}javascript{/literal}

Re: Google+ Share Button einfügen

Posted: Wed Apr 25, 2012 1:33 pm
by milos27
Timbalu wrote:Du musst Smarty anweisen die geschweiften Klammern unberücksicht zu lassen

Code: Select all

{literal}javascript{/literal}
Und wie mache ich das?

Re: Google+ Share Button einfügen

Posted: Wed Apr 25, 2012 1:41 pm
by yellowled

Code: Select all

<script type="text/javascript">{literal}
<!-- Hier Deinen Javascript-Code einfügen -->
{/literal}</script>
YL

Re: Google+ Share Button einfügen

Posted: Wed Apr 25, 2012 1:56 pm
by milos27
yellowled wrote:

Code: Select all

<script type="text/javascript">{literal}
<!-- Hier Deinen Javascript-Code einfügen -->
{/literal}</script>
YL
Hab es eingefügt aber der Button wird nicht angezeigt:

Code: Select all

<script type="text/javascript">{literal}
<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share" data-annotation="vertical-bubble" data-height="60"></div>

<!-- Place this tag after the last share tag. -->
<script type="text/javascript">
  window.___gcfg = {lang: 'de', parsetags: 'onload'};

  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>
{/literal}</script>

Re: Google+ Share Button einfügen

Posted: Wed Apr 25, 2012 2:27 pm
by yellowled

Code: Select all

<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share" data-annotation="vertical-bubble" data-height="60"></div>

<!-- Place this tag after the last share tag. -->
<script type="text/javascript">{literal}
  window.___gcfg = {lang: 'de', parsetags: 'onload'};

  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
{/literal}</script>
Der obere Teil ist ja kein JS, sondern HTML. Da muss nichts maskiert werden. Außerdem hattest Du die <script>-Elemente zusätzlich eingefügt, auch das ist natürlich nicht nötig.

YL

Re: Google+ Share Button einfügen

Posted: Wed Apr 25, 2012 3:03 pm
by milos27
@yellowled

Danke es funzt ...