i would like to know how to use a custom URL with ShareThis social share plugin. for a example i have a post summery on my index.php page taht is linking to my-post.php so what i want to do is to make users share my-post.php from my index page.
here is the code from sharethis.com
Buttons:
<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_googleplus_hcount' displayText='Google +'></span>
<span class='st_pinterest_hcount' displayText='Pinterest'></span>
JS:
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-448a73fe-e6c1-f7a5-f0a5-3912c860fc9e"});</script>
You can append a st_url property to each of your span tags which will control the URL that is shared.
<span class='st_facebook_hcount' st_url='http://my.custom.com/url' displayText='Facebook'></span>
Source: https://support.sharethis.com/hc/en-us/articles/218441477-How-to-Customize-which-URL-Text-and-IMG-to-Share
Just use st_url attribute like this:
<span class="st_sharethis" st_url="http://www.yoursite.com/innerpage.php" st_title="inner page title" displayText="ShareThis"></span>
You can just add an extra atrribute like
<div class="sharethis-inline-share-buttons" data-url="<!--YOUR_URL_GOES_HERE-->"></div>
Related
I have template php files for dates and sharing. 1 file is like this:
date-share.php:
<div class="date"><?php echo date('M d'); ?><span><?php echo date('Y'); ?></span></div>
<span class="plus"></span>Share
<!-- Tooltip -->
<div class="tooltip-social-network clearfix" style="margin-top: -10px">
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_twitter_large' displayText='Tweet'></span>
<span class='st_googleplus_large' displayText='Google +'></span>
<span class='st_pinterest_large' displayText='Pinterest'></span>
<span class='st_instagram_large' displayText='Instagram Badge' st_username='mews'></span>
<span class='st_email_large' displayText='Email'></span>
</div>
I php include it to one of my views to avoid too much clutter, instead of putting it there.
<?php include('templates/date-share.php')?>
This is how it would look like in the view when the SHARE button is clicked.
The social media icons group is just a tooltip.
However, I rerouted the view to a new url path. So I added a PHP echo base_url to all the links to maintain the root path. But I'm not sure how to apply with the php include, so I didn't add any. It still appeared but the share button can't show the tooltip anymore.
Edit: added pic for clicked SHARE without the tooltip - rerouted to a different url path
You can use view method inside view to load other view/partials.
Make sure your date-share.php under following path `application/views/template/date-share.php'
Now inside your main view load your date-share.php as below.
$this->load->view('template/date-share.php');
I am using ShareThis to integrate social websites with my site. I want to be able to set the title of the share to whatever I like. Right now I am using:
<span class='st_facebook_vcount' displayText='Facebook'></span>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js">
</script> <script type="text/javascript">
stLight.options({
publisher:'12345',
});
</script>
<span class='st_twitter_vcount' displayText='Tweet'></span>
I want part of the title to be set dynamically via php variable (name of profile owner).How can this be ddone?
Thanks,
See http://support.sharethis.com/customer/portal/articles/475079-share-properties-and-sharing-custom-information add st_title="Your title" to the span:
<span class='st_facebook_vcount' displayText='Facebook' st_title="Your title></span>
I want to create ajax updated tabs for user profile tab in frontend magento like categories tab in product management. I was use this code:
<ul id="page_tabs" class="tabs">
<li>
<a id="page_tabs_account" class="tab-item-link ajax active" href="http://localhost/magento/customer/account/" name="account">Account Dashboard</a>
</li>
<li>
<a id="page_tabs_account_edit" class="tab-item-link ajax notloaded" href="http://localhost/magento/customer/account/edit/" name="account_edit">Account Information</a>
</li>
</ul>
<script>
var FORM_KEY="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>";
var varienGlobalEvents=false;
page_tabsJsTabs = new varienTabs('page_tabs', 'tabcontainer', 'page_tabs_account',[]);
</script>
Also add js file in page.xml like:
<action method="addJs"><script>mage/adminhtml/tabs.js</script></action>
When we click on tab then ajax is call but return data is whole page data like with header, footer, left sidebar. We want only perticular tabs assigned .phtml file data (right sidebar).
So how we get that. If other method is easy then let me know.
Thanks.
You would need to create a custom controller that handles AJAX layouts.
Note that varienTabs will fetch the page set on your href links. Having http://localhost/magento/customer/account/ on your tab links will make varienTabs just fetch the content at that URL.
Also, you will need special markup where the content will be posted. There should be a div which ID consists of the ID of your tab link ID + '_content'. E.g.:
<div id="page_tabs_account_content" style="display: none;"></div>
<div id="page_tabs_account_edit_content" style="display: none;"></div>
(Edit) you would aso need the 'tabcontainer' div. It is the second parameter passed to the varienTabs function. Just wrap the divs above on it.
I'm attempting to use embedded code from a page within my server, the problem is that when I also try to add URL links to my Facebook below it they're not working?
I'm using this code which was successfully implemented. I'm not sure if the links I'm adding is hidden behind the image, but if it is I'm not sure how to get the link to show on top of the background image.
<body>
<img src="images/background.jpg" alt="" id="background" />
Facebook Link
<div rel="00000000" class="lrdiscoverwidget" data-logo="on" data-background="off" data-share-url="www.domain.com" data-css="">
<script type="text/javascript" src="http://launchrock-ignition.s3.amazonaws.com/ignition.1.1.js"></script>
</div>
<script type="text/javascript">
$(window).load(function() {
$("#background").fullBg();
});
</script>
</body>
Thank you!
I have the following code:
<a href="http://twitter.com/share" class="twitter-share-button" data-text="Text text text" data-count="none">
Tweet
</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
It adds to the text shortened url to the page on which the button was clicked. How can I disable auto adding url? Thanks.
The point of the twitter share button is to share the site you are on.
You can override it with the data-url attribute.
Tweet<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
You can at a custom url with the data-url attribute, than it ignores the url on the page he currently is:
Tweet<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>