Forum Moderators: coopster
<script type="text/javascript">
//<![CDATA[
document.write('<div id="fb-root"><\/div><fb:like href="http://<?php echo($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);?>" send="false" layout="button_count" width="70" show_faces="false" action="like" font="arial"><\/fb:like>');
(function() {
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://connect.facebook.net/en_US/all.js#xfbml=1';
s1.parentNode.insertBefore(s, s1);
})();
//]]>
</script>
http://<?php echo($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);?>
...but when I open html page in the Dreamweaver the line wich contains php shows the syntax error of some sort
Can the little php line be simple inserted within the entire script as it is? or if it not then is there any other better way of inserting current page url into href attribute
location.href? No need for PHP?
which is the same thing, but dreamweave could find it acceptable.
<script type="text/javascript">
//<![CDATA[
document.write('<div id="fb-root"><\/div><fb:like href="http://<?php echo($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);?>" send="false" layout="button_count" width="70" show_faces="false" action="like" font="arial"><\/fb:like>');
(function() {
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://connect.facebook.net/en_US/all.js#xfbml=1';
s1.parentNode.insertBefore(s, s1);
})();
//]]>
</script>
How would you place this script into include.php file?