I am using ShareThis plugin and it's working perfectly. But I am building a website something close to Facebook , and it contains images.
When I share using ShareThis plugin it shares the link to the original page. But what I want is to share the picture itself directly to Facebook (like what Instagram does with Facebook).
So is there any way to do it? I am using PHP and HTML
<div class="sharePopup" id="shareD">
<div class="iner">
<span class='st_sharethis' displayText=''></span>
<span class='st_facebook' displayText=''></span>
<span class='st_twitter' displayText=''></span>
<span class='st_linkedin' displayText=''></span>
<span class='st_pinterest' displayText=''></span>
</div>
</div>
<a href="#" class="facebook social-provider-icon"
onclick="
window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]=' + encodeURIComponent(location.href) + '&p[images][0]=<?php echo $imageforfb; ?>&p[title]=<?php echo $ftitle; ?>',
'facebook-share-dialog',
'width=626,
height=436');
return false;">
</a>
Related
I am trying to link to a specific part in my php page. I have tried all the other answers on here but none of them have helped my special problem. This is how I am trying to go to the link
<a href="<?php echo $userLoggedIn; ?>#posts_tab">
So when the user clicks the dropdown they see a list of things. One of those things being the word Profile and when the user clicks on their profile they go to their own personal profile. When they are there they have a list of items at the top that look like this:
So what I want to do is when they click the profile they are automatically on the Profile Posts tab. Like a default option. For some reason it's not working for me and I can't figure out why. Any help please ?
header.php:
<a href="<?php echo $userLoggedIn; ?>#posts_tab">
</a>
profile.php:
<a style="color: #000;" id="posts_tab" href="javascript:void(0)" onclick="openCity(event, 'Posts');">
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">
<center>Profile Posts</center>
</div>
</a>
I believe this is what you want, you need to let your profile page know that you want to load that part of profile.php, you can do it different ways I have used php and GET as example, I've sent a parameter on the URL and received it on profile.php
header.php
<a href="<?php echo $userLoggedIn; ?>?tab=posts_tab">
profile.php
<?php
$tab = $_GET["tab"];
if ($tab == "posts_tab"){
?><script>openCity(event, 'Posts');</script><?php
}
?>
<a style="color: #000;" id="posts_tab" href="javascript:void(0)" onclick="openCity(event, 'Posts');">
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">
<center>Profile Posts</center>
</div>
</a>
I am now done making my website dynamic (control multiple pages througe 1 page)
I have template where I have 2 side bars left and right, right for categories, left for the the many pages of each category.
Now using the include function to dynamicly generate the side bars is great,
but i am also using class:current on these side bars so the user can easily detect where he is.
now with the right sidebar there is no problem because if the user is in HTML category it will be highlighted with class:current but will not need to change, because user is still in HTML category.
but if the user switch page the left side bar will stay with the last class:current (for example html intro ), even tho user switched to next page (html basics).
i can only have 1 class:current when using the include function.
how can i controll that?
the code below is the file that im including to each page dynamicly it is .php file.
<div class="sidenav">
<h3> HTML Collection</h3>
<hr class="hr1">
<a class="current" style="cursor: pointer;" onclick="window.location.href = 'html_default.php';"> HTML Intro</a>
<a style="cursor: pointer;" onclick="window.location.href = 'html_editors.php';"> HTML Editors</a>
<a style="cursor: pointer;" onclick="window.location.href = 'html_basics.php';"> HTML Basics</a>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
<div class="sidenavright">
<h3> Categories</h3>
<hr class="hr1">
<a style="cursor: pointer;" onclick="window.location.href = '../javascript/js_intro.php';"> Javascript</a>
<hr class="hr1" />
<a class="current" style="cursor: pointer;" onclick="window.location.href = '../html/html_default.php';"> HTML</a>
<hr class="hr1" />
<a style="cursor: pointer;" onclick="window.location.href = '../howtomain/howto_default.php';"> HowTo</a>
<hr class="hr1" />
<a style="cursor: pointer;" onclick="window.location.href = '../python/python_intro.php';"> Python</a>
<hr class="hr1" />
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
You should be doing this all though JavaScript really, something like AngularJS, or maybe even use Laravel and it would be very easy to control it in your blade views.
Here’s something you can do however.
From the file where you are including it, define a variable before the include that will allow the include to know what page you’re on.
Like so:
$currPage = “page1”;
Then in your include, on each tag, you can programmatically put your current class on using one line if/elses, like so:
<a <?php ($currPage == “page1”) ? echo ‘class=“current”’ : echo ‘’?>>Page 1</a>
And repeat for all pages you want.
One line if/elses in PHP go like this:
Condition ? //true : //false
Good luck
I'm working on a simple project which has a requirement to show a particular block of html by passing an div id to that url.
I have tried so many solutions, but none of them worked for me.
Here is my code.
<div class="row">
<a onclick="redirect_tooltip();">
<i class="fa fa-question-circle" aria-hidden="true"></i>
</a>
</div>
Whenever I click the icon it calls a Javascript function, through that function I tried to pass a url with another page division id
function redirect_tooltip()
{
var source_type = $("#_src_type").val();
if(source_type == "source")
{
window.location.replace(base_url+'/help/tooltip#rtmp_4');
//I have already difined the base url
}
}
My html code:
<div id="rtmp_4">
<h4>Some Title</h4>
<h5> <?php echo trim($tooltip_rtmp_server[1]);?></h5>
<p> <?php echo trim($tooltip_rtmp_server[3]);?> </p>
<h5> <?php echo trim($tooltip_rtmp_stream_name[1]);?></h5>
<p> <?php echo trim($tooltip_rtmp_stream_name[3]);?> </p>
</div>
I need to display only the rtmp block whenever the url executes. Please give me a suggestions like where I am doing the mistake.
i'am using wordpress and the nextGen Gallery plugin version 1.9.13 and i read out the galleries by code with this code:
$newnggShortcodes = new NextGEN_Shortcodes;
echo $newnggShortcodes->show_gallery( array("id"=>$currGalId,"template"=>"mygallery") );
this works fine, then i can click on the image and it pops up but then i can't click to next or previous image, it only pop up the one i have clicked.
when i check out the code, the rel tag is there, i looks like this:
<div id="ngg-gallery-10-112" class="ngg-galleryoverview">
<div id="ngg-image-256" class="ngg-gallery-thumbnail-box">
<div class="ngg-gallery-thumbnail">
<a class="cboxElement" rel="lightbox[set_10]" title=" " href="PATH-TO-IMAGE.jpg">
<img class="colorbox-manual" width="420" height="200" src="PATH-TO-IMAGE.jpg.jpg" alt="dsc_0007" title="dsc_0007">
</a>
</div>
</div>
<div id="ngg-image-257" class="ngg-gallery-thumbnail-box">
<div class="ngg-gallery-thumbnail">
<a class="cboxElement" rel="lightbox[set_10]" title=" " href="http://PATH-TO-IMAGE.jpg.jpg">
<img class="colorbox-manual" width="420" height="200" src="http://PATH-TO-IMAGE.jpg.jpg" alt="dsc_0008" title="dsc_0008">
</a>
</div>
</div>
when i use the [nggallery id=10] in the backend, the it works fine.
anyone a idea?
thanks!
I found the mistake, the problem was not nextGen Gallery, the problem was that i use the jquery colorbox and the colorbox recognized it as single picture.
I was wondering if it was possible to get all the video IDs from a YouTube playlist pages and display them in a list.
<li class="playlist-video-item odd">
<a href="/watch?v=oHg5SJYRHA0&list=FLk8PLezsTU6MuuBxE5utNQw&index=3" class="tile-link-block video-tile">
<span class="video-index">3</span>
<span class="playlist-video-item-base-content">
<span class="thumb-container">
<span class="ux-thumb-wrap">
<span class="video-thumb ux-thumb-114 "><span class="clip"><img src="//i2.ytimg.com/vi/eVMWgmQA4Ig/default.jpg" alt="Thumbnail" ></span></span>
<span class="video-time">3:37</span>
<button type="button" class="addto-container addto-button short video-actions yt-uix-button yt-uix-button-short" onclick=";return false;" data-button-menu-id="shared-addto-menu" data-video-ids="oHg5SJYRHA0" data-button-action="yt.www.addtomenu.load" data-feature="thumbnail" role="button"><img class="yt-uix-button-icon yt-uix-button-icon-addto" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""><span class="yt-uix-button-content"><span class="addto-label hid">Add to</span></span><img class="yt-uix-button-arrow" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></button>
</span>
As you can see the ID is here data-video-ids="oHg5SJYRHA0"
Rather than scraping the IDs from markup like that, you should probably take a look at the YouTube API
I guess you want this to be done with jQuery, according to your tags.
$('span.ux-thumb-wrap button').data('video-ids')
Your example code only have one ID, so I wouldn't know how to create a list. Or what type of list for that matter. Please add a comment with further instrux as needed.