This is generated Twitter button, I added text inside.
> <iframe allowtransparency="true" frameborder="0" scrolling="no"
> src="http://platform.twitter.com/widgets/tweet_button.1357735024.html#_=1357817606773&count=horizontal&id=twitter-widget-0&lang=en&original_referer=&size=m&text=<?php
> echo $art["title"].'
> http://web.com/article.php?art_id='.$art["id"];?>&url=<?php
> echo
> 'http://web.com/article.php?art_id='.$art[id];?>&via=MyWeb"
> class="twitter-share-button twitter-count-horizontal" style="width:
> 107px; height: 20px;" title="Twitter Tweet Button"
> data-twttr-rendered="true"></iframe>
The problem is, that I cannot add a link into the tweet. When I add it there, there is not displayed even the simple text.
Has anyone similar issue or any help, how to fix it?
Thank you
I would reorganize your code a bit just to make the building of the iframe src easier to follow (there may be a mistake there). You should also make sure that the $art['title'] is urlencoded.
<?php
$iframe_src = 'http://platform.twitter.com/widgets/tweet_button.1357735024.html#_=1357817606773&count=horizontal&id=twitter-widget-0&lang=en&original_referer=&size=m&text=';
$iframe_src .= urlencode($art['title']);
$iframe_src .= 'http://web.com/article.php?art_id='.$art['id'];
$iframe_src .= '&url=http://web.com/article.php?art_id='.$art['id'].'&via=MyWeb';
?>
<iframe allowtransparency="true" frameborder="0" scrolling="no" src="<?php echo $iframe_src; ?>"
class="twitter-share-button twitter-count-horizontal"
style="width:107px; height: 20px;" title="Twitter Tweet Button"
data-twttr-rendered="true"></iframe>
Related
I want to hide iframe if there is no $content present.
<div class="video">
<iframe width="600px" height="400px" src="'.$content.'?autoplay=1" frameborder="0" scrolling="no" allowfullscreen style="visibility:hidden;" onload="this.style.visibility=\'visible\';"></iframe>
</div>
In my case if $content is not present, iframe loads src="?autoplay=1"
I think this will do the trick:
<?php
// Test if variable is set and has content in it
if( isset($content) && $content != "") {
echo '<div class="video"><iframe width="600px" height="400px" src="'.$content.'?autoplay=1" frameborder="0" scrolling="no" allowfullscreen style="visibility:hidden;" onload="this.style.visibility=\'visible\';"></iframe></div>'
}
?>
This way the iframe will not be printed in the html in case of no content.
I have a plugin where is displayed some news with a like facebook button.
I would change the width of this like in this site:
(see the right sidebar)
http://www.fanpage.it/moody-s-boccia-anche-la-germania-e-la-prima-volta-per-la-merkel/
This is my site:
http://www.clouderize.it/michele/
For my button I use this url but whatever width value I set, the button dimension not change!
How can I do ?
<iframe
src="http://www.facebook.com/widgets/like.php?href=<? the_permalink(); ?>&layout=button_count&width=450&action=like&colorscheme=light&font&show_faces=false&height=64"
scrolling="no" frameborder="0"
style="border:none;">
</iframe>
try this
#fb-bar iframe{min-height:80px !important;}
<div id="fb-bar">
<fb:like href="link"></fb:like>
</div>
Or
<div id="fb-bar">
<iframe
src="http://www.facebook.com/widgets/like.php?href=<? the_permalink(); ?>&layout=button_count&width=450&action=like&colorscheme=light&font&show_faces=false&height=64"
scrolling="no" frameborder="0"
style="border:none;">
</iframe>
</div>
I'm creating a dynamic site with php/mysql. There are few article. So i want to show a facebook like button for every article. How do i do this.
article show with php:
echo "<h2><a href='readmore.php?post_id= ". $id ."'>$sub</a></h2>";
Anyone can help me.
Add following code for each your article, and like button will show on each article:
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo "http://www.yousite.com/$yourArticleUrlHere"; ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px;"></iframe>
Hope it helps
echo '<iframe src="http://www.facebook.com/widgets/like.php?href=<?= "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>" scrolling="no" frameborder="0" style="border:none; width: 450px; height: 80px;"></iframe>';
Don't forget to include Facebook JavaScript SDK in the beginning, after opening body tag: http://developers.facebook.com/docs/reference/plugins/like/
I hope this code will help:
<?php
// Facebook Like button HTML 5 syntax
echo '<div class="fb-like" data-href="http://www.yourwebsite.com/readmore.php?post_id='.$id.'" data-send="true" data-width="450" data-show-faces="true"></div>';
// Facebook Like button XFBML syntax
echo '<fb:like href="http://www.yourwebsite.com/readmore.php?post_id='.$id.'" send="true" width="450" show_faces="true"></fb:like>';
?>
I have this php file which pulls from my datebase
<?php
$cdb = new PDO('mysql:dbname=xxx;host=localhost', 'xxx', 'xxx');
foreach ($cdb->query("SELECT * FROM images ORDER BY posted DESC LIMIT 3") AS $img)
{
$twofirst = substr($img['hash'], 0, 2);
echo '
<a style="position: relative; display: block; height: 140px;" href="/booru/post/view/' . $img['id'] . '" target="_blank">
<img src="booru/timthumb.php?src=images/' . $twofirst . '/' . $img['hash'] . '&h=125&w=125&q=100" width="125px" style="border-style: none"/>
</a>
';
}
Template
<div class="section">
<div class="secondaryContent">
<h3>New Cosplays</h3>
<iframe marginwidth="0" marginheight="0" width="125px" height="400px" scrolling="no" frameborder=0 src="image.php">
</iframe>
</div>
</div>
Is there a better way I can get this to work?
If I don't add the target="_blank" It just opens the page in the Iframe which is not what I want
Someone say to use AJAX but I have no idea of how to even start if someone could maybe show me an example that would be great.
Thanks for your time.
Use target="_top" instead of "_blank".
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo 'http://domainame.com/'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];?>&layout=button_count&show_faces=false&width=120&action=recommend&font=verdana&colorscheme=light&height=21"
scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;" allowTransparency="true"></iframe>
But if i'm on http://domainame.com/?bla it prints http://domainame.com//index.php?bla
if i could just send this.href but i don't know how to insert js in-line here,
help?
With your help we got working:
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo str_replace("index.php","",'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']); ?>&layout=button_count&show_faces=true&width=150&action=recommend&font&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;" allowTransparency="true"></iframe>
can get better?
Try using the following as a value for href:
<?php echo rawurlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); ?>
Try this: <?php echo rawurlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>
(BTW, you should never use $_SERVER['PHP_SELF'] for anything of this sort, due to injection vulnerabilities. Read this for details.)
I image that the page is named index.php and your server sets index.php as the default page, which would mean http://domainame.com//index.php?bla is interchangeable as a page reference to http://domainame.com/?bla.