Author Topic: Share page on social networks - droplets  (Read 18358 times)

snark

  • Guest
Share page on social networks - droplets
« on: April 19, 2010, 10:25:33 AM »
I want to incorperate some links to social networks into a website...

something like 
http://www.telegraaf.nl/buitenland/6552847/__Kasteel_Dracula_trouwlocatie__.html?p=16,1
(somewhere in the middle there are links to hyves / facebook / delicious etc)

I took the script and put it in and it kinda works but only for the complete website

ofcourse it would be much better if it would make a link to the visited page


therefor I need to display the bowserlink in a page

if the page is http://www.website.com/pages/this-and-that.php

I need to display pages%2Fthis-and-that.php



I tried to alter some droplets but I cannot figure it out...



If some-one can help out here I suppose we can easily make a droplet for each social-network-link




« Last Edit: April 26, 2010, 03:00:03 PM by snoork »

Offline crnogorac081

  • Posts: 1908
  • Gender: Male
Re: place article on social networks
« Reply #1 on: April 20, 2010, 02:23:26 PM »
Hi,

Try section picker, or section picker droplet. That may help.

cheers
no bb in signature

snark

  • Guest
Re: place article on social networks
« Reply #2 on: April 20, 2010, 06:06:59 PM »
thank you but you do not have the slightest idea what I am asking 

I will make a better explanation tommorrow

Offline crnogorac081

  • Posts: 1908
  • Gender: Male
Re: place article on social networks
« Reply #3 on: April 20, 2010, 06:08:52 PM »
Or do you mean to have buttons like: post to facebook, post to tweeter, post to digg it, post to delicious.. etc.. ?

no bb in signature

snark

  • Guest
Re: place article on social networks
« Reply #4 on: April 20, 2010, 06:14:27 PM »
yes

like: http://www.telegraaf.nl/binnenland/6565317/__Heide_in_brand_bij_Bergen_op_Zoom__.html?sn=binnenland,buitenland

I got the script no problem.. just ripped it from a website... and it works, no worries about that

but it just makes a link to the www.website.com and not to the current page


since all links are somewhat different ( facebook, twitter, linkedin etc) I think it would be best to make a set of droplets from these individual scripts

but as said therefor the current pagelink needs to be put into the script and I just do not know how...

I will post the code to one soc network tomorrow so we can take a look at it


thanks so far


snark

  • Guest
Re: place article on social networks
« Reply #5 on: April 23, 2010, 08:25:24 PM »
this is a sample of what I need to put in as code...

Code: [Select]
<a target="_blank" title="Plaats dit artikel op: Facebook" href="http://www.facebook.com/sharer.php?u=http://website.com/pages/home.php%2F&amp;t=title-of-message"><img alt="Facebook Favicon" width="16" height="16" border="0" src="http://www.website.com/media/icons/facebook.png" /></a>

can anyone tell me how to put in the url of the current page dynamically

Code: [Select]
http://website.com/pages/home.php
that way the soc media icon will produce a link to the page it is clicked from





Offline kweitzel

  • WebsiteBaker Org e.V.
  • **
  • Posts: 6983
  • Gender: Male
Re: place article on social networks
« Reply #6 on: April 23, 2010, 08:36:06 PM »
In the DB Tabel pages is a field called link. Make an SQL with the current PAGE_ID, put the result in a variable (e.g. $link) and then build the link with WB_URL and $link ...

cheers

Klaus

snark

  • Guest
Re: place article on social networks
« Reply #7 on: April 23, 2010, 09:30:47 PM »
okay
Code: [Select]
global $database, $admin;
$sql = "SELECT link FROM ".TABLE_PREFIX."pages WHERE `page_id` = '$page_id'";
$results = $database->query($sql);
if ($results && $results->numRows() > 0) {
    $row = $results->fetchRow();
$page = page_link($row['link']);
}

echo $page;

when I turn this into a droplet

Code: [Select]
global $database, $admin;
$sql = "SELECT link FROM ".TABLE_PREFIX."pages WHERE `page_id` = '$page_id'";
$results = $database->query($sql);
if ($results && $results->numRows() > 0) {
    $row = $results->fetchRow();
$page = page_link($row['link']);
}

return $page;

it doesn't work ... any suggestions/ corrections are welcome

« Last Edit: April 24, 2010, 06:52:14 PM by snoork »

snark

  • Guest
Re: Share page on social networks - droplets
« Reply #8 on: April 26, 2010, 03:08:20 PM »
find attached droplets to share your page with social networks

it lets visitors share a link to the page on their favorite social network, leaving the name of the page, the page description + the optional tekst that the visitor can add to the share

for now I did the droplets for:

  • ask
  • delicious
  • digg
  • ekudos
  • facebook
  • googlebookmarks
  • hyves
  • linkedin
  • live
  • nujij
  • twitter

[gelöscht durch Administrator]

robin

  • Guest
Re: Share page on social networks - droplets
« Reply #9 on: May 13, 2010, 02:52:45 PM »
nice work! excellent idea!
 :-D
Cheers, Robin.

Offline sky writer

  • Posts: 926
Re: Share page on social networks - droplets
« Reply #10 on: March 16, 2011, 04:32:26 PM »
I have used this droplet to Share pages on Facebook for some time, and I like it, except that I can't figure something out.

I have a "Portfolio" page which consists of one NEWS section.  If I click the Share link on a news "post" page, the LINK, "Page_Title" and "PAGE_DESCRIPTION" from the Portfolio page is used, not the News Post Page.  I would like to share the actual page that is being viewed.  Is there a way to change the code to allow for this functionality?

Code: [Select]
//:
//:
global $database, $admin;
$sql = "SELECT link FROM ".TABLE_PREFIX."pages where page_id=".PAGE_ID;
$results = $database->query($sql);
if ($results && $results->numRows() > 0) {
    $row = $results->fetchRow();
$page = page_link($row['link']);
}


return '<h1>&nbsp<a target="_blank" title="facebook: Share This Page With Your Friends" href="http://www.facebook.com/sharer.php?u='.$page.'%2F&amp;t=' .PAGE_TITLE.' - '.PAGE_DESCRIPTION.'"><img alt="Facebook Favicon" width="16" height="16" border="0" src="'.WB_URL.MEDIA_DIRECTORY.'/social/facebook.png" />facebook: Share Page</a></h1>';


Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Share page on social networks - droplets
« Reply #11 on: March 16, 2011, 04:42:49 PM »
Hello,

do you want to have the [SHARE BUTTON] only in the news posts (Long Post)?
Or is this droplet and button used only on another places?

And if only on the News Posts, which data exactly you want to submitt with the button?

Lets assume this is the code you have now:
Code: [Select]
<h1>
<a target="_blank" title="facebook: Share This Page With Your Friends" href="http://www.facebook.com/sharer.php?u='.$page.'%2F&amp;t=' .PAGE_TITLE.' - '.PAGE_DESCRIPTION.'">
<img alt="Facebook Favicon" width="16" height="16" border="0" src="'.WB_URL.MEDIA_DIRECTORY.'/social/facebook.png" />
facebook: Share Page</a>
</h1>

We have some output to be replaced:
$page = this should be the actual URL to the Post, right?
PAGE_TITLE = the actual title of the Post, right?
PAGE_DESCRIPTION = would you like to have the "short description" of the news post or a "substring" of the "full description"?

(note that there is no actual PAGE_DESCRIPTION set for the news items itself)

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Droplet: FaceBook share, for use with NEWS Module and regular pages
« Reply #12 on: March 16, 2011, 06:22:23 PM »
Hello Sky Writer,

I created the following one on the fly.

Code: [Select]
<?php
//$icon_url = WB_URL.MEDIA_DIRECTORY.'/facebook.png';
$icon_url "http://profile.ak.fbcdn.net/hprofile-ak-snc4/174597_20531316728_2866555_q.jpg";

$template = <<<_TEMPLATE_END

<span class="facebook-share">
<a target="_blank" title="facebook: Share This Page With Your Friends" href="http://www.facebook.com/sharer.php?u=[LINK]%2F&amp;t=[TITLE] - [TEASER]">
<img alt="Facebook Share" width="16" height="16" border="0" src="
$icon_url" />
facebook: Share Page</a>
</span>

_TEMPLATE_END;


// query for standard pages
$sql "SELECT `link` AS 'link', `page_title` AS 'title', `description` AS 'teaser' FROM `".TABLE_PREFIX."pages` WHERE `page_id` = ".PAGE_ID;

// query for news posts
if(defined('POST_ID')){
$sql "SELECT `link` AS 'link', `title` AS 'title', `content_short` AS 'teaser' FROM `".TABLE_PREFIX."mod_news_posts` WHERE `post_id`=".POST_ID;
}

global 
$database;
$results $database->query($sql);
if (
$results->numRows() > 0) {
    
$row $results->fetchRow();

$placeholder = array(
'[LINK]'  => WB_URL.PAGES_DIRECTORY.$row['link'].PAGE_EXTENSION,
'[TITLE]' => $row['title'],
'[TEASER]'  => $row['teaser'],
);

$ret_val str_replace(array_keys($placeholder), array_values($placeholder), $template);

return (isset(
$ret_val)) ? $ret_val : (TRUE);
This one can be used both: on NEWS Posts and on regular pages.

Note: for regular Pages you will need to fill the Page Description in Page Settings, otherwise you'll get an empty string.
For News Pages the `content_short` field is fetched from DB.

What to do:
replace the $icon_url string in the droplet.
Adjust the "template" between ....

Code: [Select]
$template =<<<_TEMPLATE_END

..... your template

_TEMPLATE_END;
... to your needs.

Should work fine.

Regards,
Stefek
« Last Edit: October 05, 2013, 10:30:07 AM by Luisehahne »
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline sky writer

  • Posts: 926
Re: Share page on social networks - droplets
« Reply #13 on: March 16, 2011, 09:08:35 PM »
Stefek,
This solution worked absolutely perfectly.  Thank you so much for your time and kindness.
Cheers!

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Share page on social networks - droplets
« Reply #14 on: March 16, 2011, 10:01:04 PM »
Hello James,

thanks for letting me know, as I myself got no facebook account I couldn't test it.
I'm glad it works.

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline firefoxfx

  • Posts: 6
Re: Share page on social networks - droplets
« Reply #15 on: April 11, 2011, 01:43:13 PM »
Hey Stefek,

Thanks for the facebook droplet, it works very good.
Is it also possible to make the same for twitter?

I tried to adjust the code but it doesn't add the news item title to the tweet, only the site name and the page title.

Thanks in advance.

Firefoxfx

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Share page on social networks - droplets
« Reply #16 on: April 11, 2011, 02:09:35 PM »
Hello,

maybe someone else may help you better, as I do not have any twitter/facebook etc. account.
I don't know the mechanics of those services.
But it should be possible with some small adjustments of the Droplet.

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline dbs

  • Betatester
  • **
  • Posts: 8011
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Share page on social networks - droplets
« Reply #17 on: July 02, 2011, 09:39:31 AM »
Nice Droplet Stefek,

but in wb2.8.2 or 2.8.1 it seems the content_short will not displayed.

works well, thx.


dbs
« Last Edit: July 09, 2011, 08:56:54 AM by dbs »

Offline golem

  • Posts: 4
Re: Share page on social networks - droplets
« Reply #18 on: September 22, 2011, 05:44:14 PM »
Hi,

unfortuantly it doensn't work on my news-site. I am using WB 2.8.2 Rev. 1506. Is there s.th. to change on this:

Code: [Select]
// query for news posts
if(defined('POST_ID')){
$sql = "SELECT `link` AS 'link', `title` AS 'title', `content_short` AS 'teaser' FROM `".TABLE_PREFIX."mod_news_posts` WHERE `post_id`=".POST_ID;
}

I get the share button, but only my news.php site is visible as link. I tried to use this within my short and my long descrition. Both links go back to my news overview. Even the title is the one of the news site.

Any idea?

Thanks.

Offline crnogorac081

  • Posts: 1908
  • Gender: Male
Re: Share page on social networks - droplets
« Reply #19 on: September 22, 2011, 06:54:25 PM »
Hi,

try to replace `post_id`=".POST_ID; with `post_id`='$post_id'";

cheers
no bb in signature

Offline golem

  • Posts: 4
Re: Share page on social networks - droplets
« Reply #20 on: September 22, 2011, 08:10:44 PM »
No, didn't work.

Even when I delete this:

// query for standard pages
$sql   = "SELECT `link` AS 'link', `page_title` AS 'title', `description` AS 'teaser' FROM `".TABLE_PREFIX."pages` WHERE `page_id` = ".PAGE_ID;

// query for news posts
if(defined('post_id')){

   $sql = "SELECT `link` AS 'link', `title` AS 'title', `content_short` AS 'teaser' FROM `".TABLE_PREFIX."mod_news_posts` WHERE `post_id`=".POST_ID;
}

the result is: http://...../pages.php/ with an 404 error

When I change this to `post_id`='$post_id'"; the facebook botton does not appear. ???

Offline crnogorac081

  • Posts: 1908
  • Gender: Male
Re: Share page on social networks - droplets
« Reply #21 on: September 23, 2011, 07:02:47 PM »
wierd,

if you want you can send me a temp admin password on pm to take a look..

cheers
no bb in signature

Offline Bug

  • Posts: 237
Re: Share page on social networks - droplets
« Reply #22 on: October 22, 2011, 05:58:05 PM »
Why not just use the free stuff addthis.com offers?

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3025
  • Gender: Female
Re: Share page on social networks - droplets
« Reply #23 on: October 24, 2011, 03:07:46 AM »
No, didn't work.
When I change this to `post_id`='$post_id'"; the facebook botton does not appear. ???

$post_id  is a variable from global scope, so inside a droplet you must import( global $post_id; ) it or use $GLOBALS['post_id'].
The constant 'POST_ID' is never available from WB2.8.2. (see post-access files)
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

Offline macsmet

  • Posts: 255
Re: Share page on social networks - droplets
« Reply #24 on: September 29, 2013, 02:19:06 PM »
Hi there,

i just discovered this topic.
I can't get this to work.
When I make a new droplet (copy/pasting code) from Stefek's code it says the code is invalid.

Anyone else having this?
I know this is an old topic but I am looking for an easy way to use Twitter and Facebook with news.

Thanks!

Greetings,

MacSmet


 

postern-length