Skip to content

Instantly share code, notes, and snippets.

@haroldSanchezb
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haroldSanchezb/4a9d7f19b3f230929251 to your computer and use it in GitHub Desktop.
Save haroldSanchezb/4a9d7f19b3f230929251 to your computer and use it in GitHub Desktop.
Share
<div class="node--photo-social-share">
<div class="twitter-follow">
<a href="<?php print $twitter_url; ?>" class="twitter-follow-button" data-show-count="false" data-lang="es"></a>
</div>
<div class="field--photo-division"></div>
<div class="facebook-like">
<div class="button-share-facebook" data-url="<?php print $url_share; ?>" data-description="<?php print $field_photo_description; ?>" data-img="<?php print $img_share; ?>">
<span class="ss-icon">facebook <span class="button-share-text">Compartir</span></span>
</div>
</div>
<div class="twitter-share">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php print $url_share; ?>" data-via="<?php print $twitter_user; ?>" data-lang="en">Tweet</a>
</div>
<div class="addthis-more">
<div class="addthis_toolbox addthis_default_style"><a class="addthis_counter addthis_pill_style" addthis:url='<?php print $url_share; ?>'></a></div>
</div>
</div>
<?php
$image = node_load($nid);
$field_photo_imagen = field_get_items('node', $image, 'field_photo_imagen');
$imgpath = file_create_url($field_photo_imagen[0]['uri']);
$element = array(
'#tag' => 'meta',
'#attributes' => array(
'property' => 'og:image',
'content' => $imgpath,
),
);
drupal_add_html_head($element,'facebook_og');
drupal_add_js(drupal_get_path('module', 'cableonda_sports_photogallery').'/socialshare.js', 'file');
drupal_add_js('http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-537519c97acccbfd', 'file');
$variables['twitter_user'] = variable_get('social_network_account');
$variables['twitter_url'] = 'https://twitter.com/'.$variables['twitter_user'];
$variables['facebook_url'] = 'https://facebook.com/'.$variables['twitter_user'];
$variables['url_share'] = url(current_path(), array('absolute' => TRUE));
$variables['img_share'] = $imgpath;
<?php
// social share
drupal_add_js(drupal_get_path('module', 'cableonda_sports_photogallery').'/socialshare.js', 'file');
drupal_add_js('http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-537519c97acccbfd', 'file');
$variables['twitter_user'] = variable_get('social_network_account');
$variables['twitter_url'] = 'https://twitter.com/'.$variables['twitter_user'];
$variables['facebook_url'] = 'https://facebook.com/'.$variables['twitter_user'];
$variables['url_share'] = url(current_path(), array('absolute' => TRUE));
$field_news_image = field_get_items('node', $node, 'field_news_image');
$imgpath = file_create_url($field_news_image[0]['uri']);
$element = array(
'#tag' => 'meta',
'#attributes' => array(
'property' => 'og:image',
'content' => $imgpath,
),
);
drupal_add_html_head($element,'facebook_og');
$disqus_comment_count = "/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '".variable_get('disqus_domain')."'; // required: replace example with your forum shortname
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());";
drupal_add_js($disqus_comment_count,
array(
'type' => 'inline',
'scope' => 'footer'
)
);
$variables['field_news_disqus_identifier'] = $node->disqus['identifier'];
<div class="node--news-social-share">
<div class="twitter-follow">
<a href="<?php print $twitter_url; ?>" class="twitter-follow-button" data-show-count="false" data-lang="es"></a>
</div>
<div class="field--news-division"></div>
<div class="facebook-like">
<div class="fb-share-button" data-href="<?php print $url_share; ?>" data-type="button_count"></div>
</div>
<div class="twitter-share">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php print $url_share; ?>" data-via="<?php print $twitter_user; ?>" data-lang="en">Tweet</a>
</div>
<div class="addthis-more">
<div class="addthis_toolbox addthis_default_style"><a class="addthis_counter addthis_pill_style"></a></div>
</div>
<div class="disqus-comments">
<div class="disqus-comments-number">
<a href="<?php print $node_url; ?>#disqus_thread" data-disqus-identifier="<?php print $field_news_disqus_identifier ?>"></a>
</div>
<span>Comentarios</span>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment