Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Facebook Like Button in theme.php  (Read 10628 times)

0 Members and 1 Guest are viewing this topic.

ronny

  • Coppermine novice
  • *
  • Country: 00
  • Offline Offline
  • Posts: 49
Facebook Like Button in theme.php
« on: June 03, 2010, 08:01:15 pm »

Hallo,

Auf meinen festen PHP Seiten funktioniert der neue Like-Button von Facebook. Nur in Coppermine nicht.
Er wird zwar angezeigt aber die Übertragung der richtigen URL funktioniert noch nicht. So sieht er bis jetzt aus.

Code: [Select]
<div id="fb-root"></div>
<script>
       window.fbAsyncInit = function() {
         FB.init({appId: '131189193560262', status: true, cookie: true,
                xfbml: true});
      };
      (function() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol +
          '//connect.facebook.net/de_DE/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
      }());
      document.write('<fb:like href="http://www.vwteam.com/galerie/displayimage.php?pos=-{CURRENT_PICTURE_ID}" show_faces="false" font="verdana" width="450"></fb:like>');
</script>

Was muss ich statt {CURRENT_PICTURE_ID} in der Theme.php einfügen?

Link zu einem Bild: http://www.vwteam.com/galerie/displayimage.php?pos=-16692
Logged

Αndré

  • Administrator
  • Coppermine addict
  • ****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Facebook Like Button in theme.php
« Reply #1 on: June 03, 2010, 08:20:56 pm »

$pid
Logged

ronny

  • Coppermine novice
  • *
  • Country: 00
  • Offline Offline
  • Posts: 49
Re: Facebook Like Button in theme.php
« Reply #2 on: June 03, 2010, 08:29:47 pm »

Danke. Aber wie verbaue ich die Variable richtig innerhalb von EOT und einem Script-Block?
So wohl nicht. Das funktioniert nämlich nicht.

Code: [Select]
// HTML template for intermediate image display
$template_display_media = <<<EOT
<!-- BEGIN title -->
                                <tr>
                                        <td class="tableb" height="50"><center>
                                                <font class="headtext">{TITLE}</font>
                                        </center></td>
                                </tr>
<!-- END title -->
               <tr><td align="center" class="display_media" nowrap="nowrap">
       
                <table cellspacing="2" cellpadding="0" class="imageborder">
                               
                            <tr>
                                        <td align="center">
                                                {IMAGE}

                                        </td>
                                </tr>
  <tr>
<td align="center">
<div id="fb-root"></div>
<script>
       window.fbAsyncInit = function() {
         FB.init({appId: '131189193560262', status: true, cookie: true,
                xfbml: true});
      };
      (function() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol +
          '//connect.facebook.net/de_DE/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
      }());
      document.write('<fb:like href="http://www.vwteam.com/galerie/displayimage.php?pos=-$pid" show_faces="false" font="verdana" width="450"></fb:like>');
    </script>
    </td>
  </tr>

                        </table>
                </td></tr>
                <tr><td>
                                                <table width="100%" cellspacing="2" cellpadding="0" class="tableb">
                                <tr>
                                        <td align="center">

                                                {ADMIN_MENU}
                                        </td>
                                </tr>
                        </table>





<!-- BEGIN img_desc -->
                        <table cellpadding="0" cellspacing="0" class="tableb" width="100%">

<!-- BEGIN caption -->
                                <tr>
                                        <td class="tableb">
                                        <b>Beschreibung:</b><br><br>
                                        <center>{CAPTION}</center><br>
                                        </td>
                                </tr>
                               
<!-- END caption -->
<!-- END img_desc -->
                               
                        </table>

                </td>
        </tr>


EOT;
Logged

Αndré

  • Administrator
  • Coppermine addict
  • ****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Facebook Like Button in theme.php
« Reply #3 on: June 03, 2010, 08:52:09 pm »

Wieso sollte das so nicht funktionieren? In deinem HTML-Quelltext steht nun:
Quote
                        <script>
                                  window.fbAsyncInit = function() {
                                   FB.init({appId: '131189193560262', status: true, cookie: true,
                                        xfbml: true});
                                 };
                                 (function() {
                                   var e = document.createElement('script');
                                     e.type = 'text/javascript';
                                    e.src = document.location.protocol +
                                        '//connect.facebook.net/de_DE/all.js';
                                     e.async = true;
                                     document.getElementById('fb-root').appendChild(e);
                                   }());
                                   document.write('<fb:like href="http://www.vwteam.com/galerie/displayimage.php?pos=-16692" show_faces="false" font="verdana" width="450"></fb:like>');
                                 </script>

Die Bild-ID wird korrekt eingebaut. Wenn es also nicht funktioniert, muss es an irgendwo an dem restlichen Code haken.
Logged

ronny

  • Coppermine novice
  • *
  • Country: 00
  • Offline Offline
  • Posts: 49
Re: Facebook Like Button in theme.php
« Reply #4 on: June 03, 2010, 09:00:14 pm »

Oha, das scheint ein grunlegendes Problem zu sein.

Ich habe spasseshalber mal die aktuelle Nummer direkt in den Code geschrieben.
pos=-16692 nur zum testen, ob es überhaupt gehen würde.

Der Button sagt zwar, dass mir das gefällt, auf Facebook wird der Link aber nicht angezeigt.
Auf einer normalen PHP Seite ausserhalb der Galerie funktioniert es aber, siehe hier:

http://www.vwteam.com/woerthersee-webcam.php
Logged

Αndré

  • Administrator
  • Coppermine addict
  • ****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Facebook Like Button in theme.php
« Reply #5 on: June 04, 2010, 08:14:58 am »

Unterschiede:
<fb:like href="' + document.location + '"
<fb:like href="www.vwteam.com/galerie/displayimage.php?pos=-16692"

Entweder du benutzt in deinem Script auch einfach document.location, oder du fügst vor deinen Link noch das fehlende http:// ein.
Logged

ronny

  • Coppermine novice
  • *
  • Country: 00
  • Offline Offline
  • Posts: 49
Re: Facebook Like Button in theme.php
« Reply #6 on: June 04, 2010, 09:18:22 am »

Hi André,

die Unterschiede kommen vom rumprobieren. Hatte auch schon beide Scripte gleich.

Wie ich jetzt rausgefunden habe, haben viele andere Seiten auch das Problem.
Unter anderem auch CNN.com und weitere grosse. Scheint ein Facebook-Problem zu sein.
Siehe auch hier: http://bugs.developers.facebook.com/show_bug.cgi?id=10740

Lass erstmal gut sein André. Danke für Deine Hilfe!  ;)
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 20 queries.