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 (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
Hi,
Try section picker, or section picker droplet. That may help.
cheers
thank you but you do not have the slightest idea what I am asking
I will make a better explanation tommorrow
Or do you mean to have buttons like: post to facebook, post to tweeter, post to digg it, post to delicious.. etc.. ?
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
this is a sample of what I need to put in as 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
http://website.com/pages/home.php
that way the soc media icon will produce a link to the page it is clicked from
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
okay
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
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
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]
nice work! excellent idea!
:-D
Cheers, Robin.
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?
//:
//:
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>';
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:
<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
Hello Sky Writer,
I created the following one on the fly.
<?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 ....
$template =<<<_TEMPLATE_END
..... your template
_TEMPLATE_END;
... to your needs.
Should work fine.
Regards,
Stefek
Stefek,
This solution worked absolutely perfectly. Thank you so much for your time and kindness.
Cheers!
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
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
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
Nice Droplet Stefek,
but in wb2.8.2 or 2.8.1 it seems the content_short will not displayed.
works well, thx.
dbs
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:
// 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.
Hi,
try to replace `post_id`=".POST_ID; with `post_id`='$post_id'";
cheers
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. ???
wierd,
if you want you can send me a temp admin password on pm to take a look..
cheers
Why not just use the free stuff addthis.com offers?
Quote from: golem on September 22, 2011, 08: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)
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
Hi, you mean stefeks colored code?
This forum has changed the codes a little bit.
This:
$sql = "SELECT `link` AS 'link',
Should looks like this:
$sql = "SELECT `link` AS 'link',
and so on.
Hi dbs,
Thanks for your reply.
It works now. But it only gives me the website title and page URL.
It doesn't copy the news message into the facebook sharer.
Bummer!
greetings,
MacSmet
Hey MacSmet,
QuoteIt doesn't copy the news message into the facebook sharer.
Thats been depreciated by FB anyway because of the possibility to spam.
Cheerz,
Tez Oner
Hi Tez,
Thanks, I didn't know that.
greetings,
MacSmet