开发者

PHP/HTML echo a variable in a div

I have a div which works fine

  <div id="fb-root"></div>
   <fb:like href="<?php echo $link; ?>" send="true" width="450" show_faces="true" font=""> 
   </fb:like>

If I try to use an echo, I don't get the value of $link when I do this.

开发者_如何学Go
echo '<div id="fb-root"></div>
<fb:like href="<?php echo $link; ?>" send="true" width="450" show_faces="true" font="">
</fb:like>';

likewise this one too. i cannot get the $link.

echo '<iframe src="http://www.facebook.com/plugins/like.php?app_id=208015255907895&amp;href="',$link,'"&amp;send=true&amp;layout=button_count&amp;width=50&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=trebuchet+ms&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:21px;" allowTransparency="true"></iframe> '

Any help?


You can't use <?php ... ?> in an echo. Try:

echo '<div id="fb-root"></div><fb:like href="', $link, '" send="true" width="450" show_faces="true" font=""></fb:like>';


echo '<div id="fb-root"></div><fb:like href="'.$link.'" send="true" width="450" show_faces="true" font=""></fb:like>';

you cannot add <?php ?> brackets into your echo


you are messing up ' " and a new php tag

echo '<div id="fb-root"></div>
<fb:like href="'. $link .'" send="true" width="450" show_faces="true" font="">
</fb:like>';


Try This:

echo '<div id="fb-root"></div>
 <fb:like href="'.$link.'" send="true" width="450" show_faces="true" font="">
 </fb:like>';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜