Google+ Share Button einfügen

Hier können Probleme und alles andere in Deutscher Sprache gelöst werden.
Post Reply
milos27
Regular
Posts: 154
Joined: Sun Jul 06, 2008 8:31 pm
Contact:

Google+ Share Button einfügen

Post 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
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Google+ Share Button einfügen

Post by Timbalu »

Du musst Smarty anweisen die geschweiften Klammern unberücksicht zu lassen

Code: Select all

{literal}javascript{/literal}
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
milos27
Regular
Posts: 154
Joined: Sun Jul 06, 2008 8:31 pm
Contact:

Re: Google+ Share Button einfügen

Post 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?
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Google+ Share Button einfügen

Post by yellowled »

Code: Select all

<script type="text/javascript">{literal}
<!-- Hier Deinen Javascript-Code einfügen -->
{/literal}</script>
YL
milos27
Regular
Posts: 154
Joined: Sun Jul 06, 2008 8:31 pm
Contact:

Re: Google+ Share Button einfügen

Post 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>
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Google+ Share Button einfügen

Post 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
milos27
Regular
Posts: 154
Joined: Sun Jul 06, 2008 8:31 pm
Contact:

Re: Google+ Share Button einfügen

Post by milos27 »

@yellowled

Danke es funzt ...
Post Reply