News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Share This Topic

Started by All Colours Sam, September 06, 2009, 05:09:23 AM

Previous topic - Next topic

mirahalo

Quote from: eng_HK on July 21, 2010, 09:45:11 AM
@130860

I checked but my template don't have a display.blablabla



did you created a facbook app?

please attach your display.template.php  if your theme doesn't have a display  attach the on in the default theme

eng_HK

I created the FB ID application.

mirahalo


eng_HK

seams have no effects...
What did you changed?

mirahalo

I added the button, did you active the button in the settings?  ca I see a link to your forum?

JDz

#505
Hello, please help me!  :(

I did a stupid mistake deleting first the file of share this topic v1.4 on the ftp so now in the administration tool of the board I can't delete it because obviously it doesn't find the install file.
Off course when I've tried to install the v2.0 version there were several problems.
How can I delete the v1.4 version?

Thnx in advance for your help!

ps
unfortunately I haven't done a back up of the v1.4

mirahalo

well, the only thing I can think is to you upload the files I told you so I can erase the mod manually, please attach the following:

yourtheme's:
display.template.php

if your theme doesn't have a display.attach the one in the default theme.

./Sources/Admin.php
./Sources/ManageSettings.php

eng_HK

#507
@130860 I checked the box for the button.
For sure if you want to check the forum have a look to ....

remove the ( and the space

Thx in advance

mirahalo

 you don't have to use all the ) and (  simply put it like this:   h**p://mysite.com    or just mysite.com :)

evillive

Is there anyway to use this with the ssi.php page for function ssi_boardNews? I want o have the like buttin in the far right corner of the news topics on my main page and have the share buttons at the very bottom under the comments button. I didn't see anything about ssi in this post so far.
Thanks in advance for any help

mirahalo

its possible, do you want the like button and the share icons on every news or just the first one?

can I have a link to your site?  and also, what method are you using to show the news,  the default one:

<?php ssi_boardNews(); ?>

or an array with custom code?  an array will be more easy to modified and better because its not recommended to edit SSI.php directly.


evillive

I would like to have the like button and share buttons on every news post.

The site is wheresmyservice.com [nofollow] and I have using eazyportal to post the news. It uses the same function that is in the ssi.php.

function EzBlockBoardNewsBlock($paramters = array(),$board = null, $length = null, $limit = null, $start = null)
{
global $scripturl, $smcFunc, $txt, $settings, $modSettings, $context;


// Pass all the parematers
foreach($paramters as $myparam)
{
if ($myparam['parameter_name'] == 'board')
$board = (int) $myparam['data'];
if ($myparam['parameter_name'] == 'limit')
$limit = (int) $myparam['data'];

if ($myparam['parameter_name'] == 'length')
$length = (int) $myparam['data'];
}



loadLanguage('Stats');

// Must be integers....
if ($limit === null)
$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
else
$limit = (int) $limit;

if ($start === null)
$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
else
$start = (int) $start;

if ($length === null)
$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
else
$length = (int) $length;

$limit = max(0, $limit);
$start = max(0, $start);


// Load the message icons - the usual suspects.
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

// Find the post ids.
$request = $smcFunc['db_query']('', "
SELECT ID_FIRST_MSG
FROM {db_prefix}topics
WHERE ID_BOARD IN($board)
ORDER BY ID_FIRST_MSG DESC
LIMIT $start, $limit");
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['ID_FIRST_MSG'];
$smcFunc['db_free_result']($request);

if (empty($posts))
return array();

// Find the posts.
$request = $smcFunc['db_query']('', "
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.ID_TOPIC, m.ID_MEMBER, m.smileys_enabled, m.ID_MSG, t.locked
FROM ({db_prefix}topics AS t, {db_prefix}messages AS m)
LEFT JOIN {db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_FIRST_MSG DESC
LIMIT " . count($posts));
$return = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// If we want to limit the length of the post.
if (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $length);

// The first space or line break. (<br />, etc.)
$cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<'));

if ($cutoff !== false)
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['ID_MSG']);

// Check that this message icon is there...
if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

$return[] = array(
'id' => $row['ID_TOPIC'],
'message_id' => $row['ID_MSG'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['num_replies'] . ' ' . ($row['num_replies'] == 1 ? $txt['ezp_built_news_1'] : $txt['ezp_built_news_2']) . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ezp_built_news_3'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['num_replies'] . '">' . $txt['ezp_built_news_3'] . '</a>',
'poster' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['poster_name'],
'href' => !empty($row['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] : '',
'link' => !empty($row['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false
);
}
$smcFunc['db_free_result']($request);

if (empty($return))
return;

$return[count($return) - 1]['is_last'] = true;


foreach ($return as $news)
{
echo '
<div>
<a href="', $news['href'], '">', $news['icon'], '</a> <b>', $news['subject'], '</b>
<div class="smaller">', $news['time'], ' ', $txt['ezp_built_by'], ' ', $news['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>

', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '
</div>';

if (!$news['is_last'])
echo '
<hr style="margin: 2ex 0;" width="100%" />';
}

}


Thanks for the super fast reply let me know what I can do to make this work.

mirahalo

I never used eazyportal before, let me make a few test on local before I give you an answer.

evillive

Thanks for taking the time to look into this. I hope it can be done without too much trouble.

pviagem

Hi there

First of all, thank you very much for this great MOD.

I'm using the MOD and everything seems working without problems except with this:

The button Like | Be the first of you friends to like this never changes even if someone has used it.

If I'm coming from facebook to my forum, it shows how many times the button was used (XX people like this.) but if I'm just navigating over the forum, the description is always the same: Like | Be the first of you friends to like this. No info about how many users Like the topic.

Any idea about what is happening?

Many thanks.

mirahalo

it show the message because you're not log in on Facebook, you need to be log in to facebook to get access to all the stats including how many people like the topic and if your friends liked it will show your friends photo,   go to a topic where the button with that message is show,  open a new tab on your browser, log in to face book,   refresh the topic page, now you will see the change.

mirahalo

#516
@evillive   replace your ez portal function with this one:

function EzBlockBoardNewsBlock($paramters = array(),$board = null, $length = null, $limit = null, $start = null)
{
global $scripturl, $smcFunc, $txt, $settings, $modSettings, $context;






// Pass all the parematers
foreach($paramters as $myparam)
{
if ($myparam['parameter_name'] == 'board')
$board = (int) $myparam['data'];
if ($myparam['parameter_name'] == 'limit')
$limit = (int) $myparam['data'];

if ($myparam['parameter_name'] == 'length')
$length = (int) $myparam['data'];
}



loadLanguage('Stats');

// Must be integers....
if ($limit === null)
$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
else
$limit = (int) $limit;

if ($start === null)
$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
else
$start = (int) $start;

if ($length === null)
$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
else
$length = (int) $length;

$limit = max(0, $limit);
$start = max(0, $start);


// Load the message icons - the usual suspects.
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

// Find the post ids.
$request = $smcFunc['db_query']('', "
SELECT ID_FIRST_MSG
FROM {db_prefix}topics
WHERE ID_BOARD IN($board)
ORDER BY ID_FIRST_MSG DESC
LIMIT $start, $limit");
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$posts[] = $row['ID_FIRST_MSG'];
$smcFunc['db_free_result']($request);

if (empty($posts))
return array();

// Find the posts.
$request = $smcFunc['db_query']('', "
SELECT
m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
t.num_replies, t.ID_TOPIC, m.ID_MEMBER, m.smileys_enabled, m.ID_MSG, t.locked
FROM ({db_prefix}topics AS t, {db_prefix}messages AS m)
LEFT JOIN {db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_FIRST_MSG DESC
LIMIT " . count($posts));
$return = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// If we want to limit the length of the post.
if (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $length);

// The first space or line break. (<br />, etc.)
$cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<'));

if ($cutoff !== false)
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['ID_MSG']);

// Check that this message icon is there...
if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

censorText($row['subject']);
censorText($row['body']);

$return[] = array(
'id' => $row['ID_TOPIC'],
'message_id' => $row['ID_MSG'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['num_replies'] . ' ' . ($row['num_replies'] == 1 ? $txt['ezp_built_news_1'] : $txt['ezp_built_news_2']) . '</a>',
'replies' => $row['num_replies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ezp_built_news_3'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['num_replies'] . '">' . $txt['ezp_built_news_3'] . '</a>',
'poster' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['poster_name'],
'href' => !empty($row['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] : '',
'link' => !empty($row['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
),
'locked' => !empty($row['locked']),
'is_last' => false
);
}
$smcFunc['db_free_result']($request);

if (empty($return))
return;

$return[count($return) - 1]['is_last'] = true;




// Build list of social icons share this topic mod
$social_icons = '';
$sites = array(
     'ask' => 'http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&url=%s',
'blinkbits' => 'http://blinkbits.com/bookmarklets/save.php?v=1&source_url=%s',
'blinklist' => 'http://blinklist.com/index.php?Action=Blink/addblink.php&Url=%s',
'bloglines' => 'http://www.bloglines.com/sub/%s',
'bmarks' => 'http://blogmarks.net/my/new.php?mini=1&simple=1&url=%s',
'delicious' => 'http://del.icio.us/post?url=%s',
'digg' => 'http://digg.com/submit?phase=2&url=%s',
'dzone' => 'http://www.dzone.com/links/add.html?description&url=%s',
'facebook' => 'http://www.facebook.com/share.php?u=%s',
'feedmelinks' => 'http://feedmelinks.com/categorize?from=toolbar&op=submit&url=%s',
'furl' => 'http://furl.net/storeIt.jsp?u=%s',
'google' => 'http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=%s',
'live' => 'https://skydrive.live.com/sharefavorite.aspx/.SharedFavorites??marklet=1&url=%s',
'magnolia' => 'http://ma.gnolia.com/bookmarklet/add?url=%s',
'myspace' => 'http://www.myspace.com/index.cfm?fuseaction=postto&amp;c=&amp;t=&amp;u=%s',
'netvouz' => 'http://netvouz.com/action/submitBookmark?url=%s',
'newsvine' => 'http://www.newsvine.com/_wine/save?u=%s',
'oneview' => 'http://www.oneview.de/quickadd/neu/addBookmark.jsf?URL=%s',
'reddit' => 'http://reddit.com/submit?url=%s',
'rojo' => 'http://www.rojo.com/add-subscription/?resource=%s',
'scuttle' => 'http://www.scuttle.org/bookmarks.php/maxpower?action=add&address=%s',
'shadows' => 'http://www.shadows.com/shadows.aspx?url=%s',
'slashdot' => 'http://slashdot.org/bookmark.pl?url=%s',
'spurl' => 'http://www.spurl.net/spurl.php?url=%s',
'squidoo' => 'http://www.squidoo.com/lensmaster/bookmark?%s',
'stumbleupon' => 'http://www.stumbleupon.com/submit?url=%s',
'technorati' => 'http://www.technorati.com/faves?add=%s',
'twitter' => 'http://twitter.com/home?status=%s',
'tipd' => 'http://tipd.com/submit.php?url=%s',
'google' => 'http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=%s',
'yahoo' => 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=%s',
'gbuzz' => 'http://www.google.com/reader/link?url=%s',


);


foreach($sites as $site => $url) {
$entry = 'share_' . $site;
$page_url = $return['0']['href'];
if(!empty($modSettings[$entry]) && $modSettings[$entry]) {
$social_icons .= sprintf('<a href="' . $url . '" target="_blank"><img src="' . $settings['images_url'] . '/share/' . $site . '.gif" align="bottom" title="' . $txt['share_default_tooltip'] . '" alt="' . $txt['share_default_tooltip'] . '" /></a>', urlencode($page_url), $txt[$entry], $txt[$entry]);
}
}
   
if($social_icons == "")
$social_icons = '<img src="' . $settings['images_url'] . '/topic/' . $context['class'] . '.gif" align="bottom" alt="" />';


    // Share this topic mod end




foreach ($return as $news)
{
echo '
<div>
<div style="float:left;"><a href="', $news['href'], '">', $news['icon'], '</a> <b>', $news['subject'], '</b> </div><div style="float:right;"><div id="fblike" style="float:right; padding:2px;">
<fb:like href="', urlencode($page_url) ,'"  width="', !empty($modSettings['share_likebutton_width']) ? $modSettings['share_likebutton_width'] : '', '"></fb:like>
             </div></div>
<div class="smaller" style="clear:both;">', $news['time'], ' ', $txt['ezp_built_by'], ' ', $news['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>

', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '
<br />', $social_icons, '</div>';

if (!$news['is_last'])
echo '
<hr style="margin: 2ex 0;" width="100%" />';
}

}



and now, open your index.template.php file, find this:

<body>


and add after this:


// share this topic facebook like buttom start
if (!empty($modSettings['share_likebutton_enable']))
    {
echo '<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: \'', !empty($modSettings['share_likebutton_appid']) ? $modSettings['share_likebutton_appid'] : '', '\', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement(\'script\'); e.async = true;
    e.src = document.location.protocol +
      \'//connect.facebook.net/', !empty($modSettings['share_likebutton_lang']) ? $modSettings['share_likebutton_lang'] : 'en_US', '/all.js\';
    document.getElementById(\'fb-root\').appendChild(e);
  }());
</script>';
}



the facebook like will take the width you put on the mod settings

evillive

Thanks I got the share buttons working but the eidt I make in index.template causes the page not to load. Maybe I am not adding it correctly.

evillive

No mater what I do to the template the page messes up. Either the css gets roken or the page wont load. The share icons work great but for some reason I just cant get that facebook like button to work.

Thanks for the work I hope I can figure this thing out.

mirahalo

can you attach your index.template.php here so I can take a look

Advertisement: