Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 26, 2012, 08:24:00 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter
hier
und auf unserer
neuen Webseite
.
155534
Posts in
21713
Topics by
7737
Members
Latest Member:
chris85
WebsiteBaker Community Forum
English
Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
(Moderator:
Argos
)
Share page on social networks - droplets
Pages: [
1
]
Go Down
Author
Topic: Share page on social networks - droplets (Read 3487 times)
snark
Guest
Share page on social networks - droplets
«
on:
April 19, 2010, 09: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, 02:00:03 PM by snoork
»
Logged
crnogorac081
AddOn Development
Offline
Posts: 1706
Re: place article on social networks
«
Reply #1 on:
April 20, 2010, 01:23:26 PM »
Hi,
Try section picker, or section picker droplet. That may help.
cheers
Logged
Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
snark
Guest
Re: place article on social networks
«
Reply #2 on:
April 20, 2010, 05:06:59 PM »
thank you but you do not have the slightest idea what I am asking
I will make a better explanation tommorrow
Logged
crnogorac081
AddOn Development
Offline
Posts: 1706
Re: place article on social networks
«
Reply #3 on:
April 20, 2010, 05: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.. ?
Logged
Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
snark
Guest
Re: place article on social networks
«
Reply #4 on:
April 20, 2010, 05: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
Logged
snark
Guest
Re: place article on social networks
«
Reply #5 on:
April 23, 2010, 07:25:24 PM »
this is a sample of what I need to put in as code...
Code:
<a target="_blank" title="Plaats dit artikel op: Facebook" href="http://www.facebook.com/sharer.php?u=http://website.com/pages/home.php%2F&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:
http://website.com/pages/home.php
that way the soc media icon will produce a link to the page it is clicked from
Logged
kweitzel
Forum administrator
Offline
Posts: 6975
Re: place article on social networks
«
Reply #6 on:
April 23, 2010, 07: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
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
snark
Guest
Re: place article on social networks
«
Reply #7 on:
April 23, 2010, 08:30:47 PM »
okay
Code:
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:
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, 05:52:14 PM by snoork
»
Logged
snark
Guest
Re: Share page on social networks - droplets
«
Reply #8 on:
April 26, 2010, 02: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
Logged
robin
Offline
Posts: 18
Re: Share page on social networks - droplets
«
Reply #9 on:
May 13, 2010, 01:52:45 PM »
nice work! excellent idea!
Cheers, Robin.
Logged
sky writer
Offline
Posts: 285
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:
//:
//:
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> <a target="_blank" title="facebook: Share This Page With Your Friends" href="http://www.facebook.com/sharer.php?u='.$page.'%2F&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>';
Logged
Stefek
WebsiteBaker Org e.V.
Offline
Posts: 4884
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:
<h1>
<a target="_blank" title="facebook: Share This Page With Your Friends" href="http://www.facebook.com/sharer.php?u='.$page.'%2F&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
Logged
"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Stefek
WebsiteBaker Org e.V.
Offline
Posts: 4884
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:
<?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&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:
$template =<<<_TEMPLATE_END
..... your template
_TEMPLATE_END;
... to your needs.
Should work fine.
Regards,
Stefek
«
Last Edit: March 16, 2011, 06:30:06 PM by Stefek
»
Logged
"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
sky writer
Offline
Posts: 285
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!
Logged
Stefek
WebsiteBaker Org e.V.
Offline
Posts: 4884
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
Logged
"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
firefoxfx
Offline
Posts: 1
Re: Share page on social networks - droplets
«
Reply #15 on:
April 11, 2011, 12: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
Logged
Stefek
WebsiteBaker Org e.V.
Offline
Posts: 4884
Re: Share page on social networks - droplets
«
Reply #16 on:
April 11, 2011, 01: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
Logged
"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
dbs
WebsiteBaker Org e.V.
Offline
Posts: 3719
Re: Share page on social networks - droplets
«
Reply #17 on:
July 02, 2011, 08: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, 07:56:54 AM by dbs
»
Logged
golem
Offline
Posts: 4
Re: Share page on social networks - droplets
«
Reply #18 on:
September 22, 2011, 04: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:
// 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.
Logged
crnogorac081
AddOn Development
Offline
Posts: 1706
Re: Share page on social networks - droplets
«
Reply #19 on:
September 22, 2011, 05:54:25 PM »
Hi,
try to replace `post_id`=".POST_ID; with `post_id`='$post_id'";
cheers
Logged
Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
golem
Offline
Posts: 4
Re: Share page on social networks - droplets
«
Reply #20 on:
September 22, 2011, 07: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.
Logged
crnogorac081
AddOn Development
Offline
Posts: 1706
Re: Share page on social networks - droplets
«
Reply #21 on:
September 23, 2011, 06:02:47 PM »
wierd,
if you want you can send me a temp admin password on pm to take a look..
cheers
Logged
Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Bug
Offline
Posts: 188
Re: Share page on social networks - droplets
«
Reply #22 on:
October 22, 2011, 04:58:05 PM »
Why not just use the free stuff addthis.com offers?
Logged
DarkViper
Development Team
Offline
Posts: 1252
Re: Share page on social networks - droplets
«
Reply #23 on:
October 24, 2011, 02:07:46 AM »
Quote from: golem on September 22, 2011, 07:10:44 PM
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)
Logged
Anleitungen lesen und selber nachdenken ist anstrengend... Da lass ich doch lieber andere für mich denken...
In
1984
: Nineteen Eighty-Four is a unrealistic utopia!!
In
2012
: Nineteen Eighty-Four is a little piece only of our reality!!
Pages: [
1
]
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> WebsiteBaker Website Showcase
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
=====> Modules / Extensions
===> Suggestions
===> Software bugs
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
=====> Module / Extensions
===> Vorschläge
===> Softwarefehler
===> Erfahrungs und Testberichte
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...