Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-11-2007, 04:16 AM
Casual Pligger
 
Join Date: Jul 2007
Posts: 62
Thanks: 10
Thanked 0 Times in 0 Posts
Share to Facebook

Hey, does anyone know how to properly implement a "Share to Facebook" button in the "Add to this . . ." shakebox?

I've tried but I keep getting error after error. Specifically, errors originating because "u" is not a variable in class.compiler.php. I'm not a programmer and am really stuck but will greatly benefit from the ability to share on Facebook directly from my site.

For whatever reason, Facebook forces you to use a script that encodes the share URL. They have posted instructions on how to add their share buttons to "any site on the internet," but this does not work for Pligg 9.7. (See for yourself: Facebook | Share Partners)

There are three codes (you choose one) that you're forced to use.

Link Only:
HTML Code:
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank">Share on Facebook</a> 
Link and Image:
HTML Code:
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_link { padding:2px 0 0 20px; height:16px; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?12:26981) no-repeat top left; }</style><a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank" class="fb_share_link">Share on Facebook</a> 
Styled Link and Image:
HTML Code:
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_button { display: -moz-inline-block; display:inline-block; padding:1px 20px 0 5px; height:15px; border:1px solid #d8dfea; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?12:26981) no-repeat top right; } html .fb_share_button:hover { color:#fff; border-color:#295582; background:#3b5998 url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?12:26981) no-repeat top right; text-decoration:none; } </style> <a href="http://www.facebook.com/share.php?u=<url>" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;">Share</a> 
Has anyone been able to implement? I know it's possible because http://videos.brainfall.com is Powered by Pligg and implements this mod (as well as a pretty cool video embed) nicely.

Please help if you can! Thanks in advance.

Last edited by ZeroHoursOfSleep; 09-11-2007 at 04:20 AM..
Reply With Quote
  #2 (permalink)  
Old 11-19-2007, 03:24 PM
New Pligger
Pligg Version: 9.9.5
Pligg Template: SilverBullet
 
Join Date: Oct 2007
Location: Alberta, Canada
Posts: 12
Thanks: 3
Thanked 0 Times in 0 Posts
Has this been figured out yet? I would also like to implement this feature.
Reply With Quote
  #3 (permalink)  
Old 11-19-2007, 03:39 PM
chuckroast's Avatar
Coder/Designer
Pligg Version: 1.0
Pligg Template: ExpertVision
 
Join Date: Jun 2006
Location: PA
Posts: 2,398
Thanks: 171
Thanked 439 Times in 278 Posts
First create an icon or grab one off facebook and upload it to the images folder of the template your using. Let's call it facebook.png

Open linksummary.tpl and find

Code:
<span id="addto-{$link_shakebox_index}" style="display:none"><br />{#PLIGG_Visual_LS_AddTo#}
Then add something like this.

Code:
<a href="http://www.facebook.com/share.php?u={$enc_url}"><img src="{$my_base_url}{$my_pligg_base}/templates/{$the_template}/images/facebook.png" border="0" alt="submit '{$title_short}' to Facebook" /></a>
That should do it.
__________________
Visit PliggPro the official Pligg Mods & Template Shop!

Reply With Quote
The Following 2 Users Say Thank You to chuckroast For This Useful Post:
  #4 (permalink)  
Old 11-23-2007, 11:55 AM
New Pligger
 
Join Date: Jul 2007
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Very nice ! That code works fine for us !!!
It would be nice to be able to promote the story link !! What do you think ?
I just don't know how to code it !
Reply With Quote
  #5 (permalink)  
Old 11-23-2007, 12:09 PM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 914
Thanks: 169
Thanked 17 Times in 17 Posts
I think you added the wrong URL to your website the correct one shoud be like this right?

Brainfall.com Videos / Popular Videos

I will also be adding this new feature thanks for the code and if possible can you share the image you will be using
Reply With Quote
  #6 (permalink)  
Old 11-25-2007, 05:17 AM
Constant Pligger
 
Join Date: Feb 2007
Posts: 183
Thanks: 13
Thanked 24 Times in 19 Posts
I think you should use the source's original url when providing this kind of feature but here is solution to your request.

Change from Chuck's code the {$enc_url} to {$my_base_url}{$story_url} and that should do it.
Reply With Quote
  #7 (permalink)  
Old 11-26-2007, 03:05 PM
New Pligger
 
Join Date: Jul 2007
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Nice it works fine !!! You're the best !
Reply With Quote
  #8 (permalink)  
Old 12-05-2007, 11:46 AM
Constant Pligger
 
Join Date: Jan 2007
Posts: 314
Thanks: 0
Thanked 8 Times in 6 Posts
Quote:
Originally Posted by Coolaid View Post
Nice it works fine !!! You're the best !
For some reason when I use {$my_base_url}{$story_url} it only shows my domain name and the link to the story but not the title of the story and the summary of the story. And of course when click on the title of the story should take the user to the story page on my site. Any idea how to fix this?

ex: example.com
http://mypligg.com/out.php?title=blahblahblah

but I want it to be like:

title of the story
http://mypligg.com/out.php?title=todaystory
__________________
http://www.blogmyway.org
Reply With Quote
  #9 (permalink)  
Old 12-11-2007, 09:46 AM
New Pligger
Pligg Version: 2
Pligg Template: eee
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hi all !
First, sorry for my bad english.
I want to ask you if exists a way to force facebook (in the "share on facebook" script) to put the title I want.
For example:

http://www.facebook.com/share.php?u=...ar&t=ThisTitle

If you go to the these link, when facebook's page is open, it shows another title ! I want to show "ThisTitle" and facebook shows another. I don't know if Facebook take the "meta tags" or the "title" tags of the page reffered.

Well, I will thank you for any answer !
Thanks to all.
Reply With Quote
  #10 (permalink)  
Old 06-07-2008, 05:32 AM
New Pligger
 
Join Date: May 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Cool this works for me too ...
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Facebook integration cruz Module Requests 9 09-15-2008 06:04 AM
++++ New: Facebook Connect = Open ID ++++ netwb Modification Tutorials 6 07-29-2008 03:31 AM
Share this GDFH General Help 0 07-02-2007 06:02 PM
Insighta.com - Share life advice and practical links! insighta My Pligg Site 1 04-13-2007 05:18 PM
snatchideas.com - share, comment and vote for ideas guigo My Pligg Site 0 10-24-2006 05:07 PM


Search Engine Friendly URLs by vBSEO 3.2.0