hefterbrumi Posted March 24, 2011 Share Posted March 24, 2011 Hello! I need a little help here please! This is the end of the code on a page. It shows a pic with a gallery assigned to it. I want to attach a facebook like button to the pic, not the gallery. Since its a dynamic page I modified the like button code. But for some reason I just cant fit it in. Im kind of a novice and i didnt write this code on my own:) Oh and yes I coud stick the code right into the webpage, but its a generic site so i cant do it on every single page. So how do you say in "PHP" to put "this" on the page in "this" div tag, and where do you put it in to work properly? .... $res.="<div class=\"works\"> <div class=\"worksleft\"> <div class=\"worksimg\"> <img src=\"<resource>".$img["name"]."</resource>\" width=\"".$img["x"]."\" height=\"".$img["y"]."\" alt=\"".$mass["xtitle"]."\" title=\"".$mass["xtitle"]."\" > </div> <div class=\"workstxt\">".$tit."</div> </div> <div class=\"worksright\"> ".$gal." </div> <div class=\"clear\"></div> ".$desc." </div>"; } $result[0]["head"]=""; $result[0]["body"]=$res; return($result); } .... and this is the code i have to put in: <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo "http://" . $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>&layout=button_count&show_faces=false&width=450&action=like&font&colorscheme=dark&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe> thanks very much in advance! Quote Link to comment https://forums.phpfreaks.com/topic/231586-facebook-like-button-in-generic-php/ Share on other sites More sharing options...
linus72982 Posted March 24, 2011 Share Posted March 24, 2011 So you're asking how to make it easy to insert this into each page? The easiest way is to put it in your page footer file which is a file people use to end all of their pages the same way. My footers usually have the copyright information div and </body></html> tags and all that sort of thing and then at the bottom of every page I just "include" that file: <?php include('footer.php'); ?> As long as the footer.php file includes your facebook code there, it will insert anywhere you put the include tag I just gave you, to include the in the middle of a div. Hell, if you want you can make the include file have the div start and end within the file and just insert it, whatever you want. Is this what you were looking for? Quote Link to comment https://forums.phpfreaks.com/topic/231586-facebook-like-button-in-generic-php/#findComment-1191777 Share on other sites More sharing options...
hefterbrumi Posted March 24, 2011 Author Share Posted March 24, 2011 thx actually i made my question more accurate in this post: http://www.phpfreaks.com/forums/index.php?topic=328278.0 Quote Link to comment https://forums.phpfreaks.com/topic/231586-facebook-like-button-in-generic-php/#findComment-1191783 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.