CuteNews

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Facebook like button
therockers
post Jul 21 2012, 10:49 AM
Post #1


Newbie
*

Group: Members
Posts: 3
Joined: 21-July 12
Member No.: 78,188



So I've googled and looked for codes to integrate Facebook like button into cutenews, there's really no way yet until now.

You literally have to put his on the php file that cutenews is integrated into. It took me a while to figure out how to do this, but I think it actually works.
Don't put it in Deafult.tpl because it won't work. You rather put it in your header file of your php file.


CODE
<div class="fb-like" data-href="http://<? echo $_SERVER['SERVER_NAME']; ?><? echo $_SERVER['REQUEST_URI']; ?>" data-send="false" data-layout="button_count" data-width="120" data-show-faces="true"></div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=APP_ID_HERE";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>




Using the default facebook like options, the change is only the URL, sometimes when you try to embed Facebook like button onto the Default.tpl, it'll only go to the http://yoursite.com/news.php?subaction=showfull. So to do this, we use the default like option and put in
CODE
<? echo $_SERVER['SERVER_NAME']; ?><? echo $_SERVER['REQUEST_URI']; ?>
.

CODE
<? echo $_SERVER['SERVER_NAME']; ?>
for the website URL and
CODE
<? echo $_SERVER['REQUEST_URI']; ?>
for if you have the php file like http://yoursite.com/news?subaction=showfull instead and also, it's a better way than
CODE
<? echo $_SERVER['PHP_SELF']; ?>
.


NOTE: Don't use these PHP codes on Default.tpl for tpl files cannot read PHP functions.

This post has been edited by therockers: Jul 21 2012, 02:35 PM
Go to the top of the page
 
+Quote Post
therockers
post Jul 22 2012, 09:31 PM
Post #2


Newbie
*

Group: Members
Posts: 3
Joined: 21-July 12
Member No.: 78,188



QUOTE (QuestADay @ Jul 22 2012, 11:38 AM) *
I'm new to cutephp, but I need this functionality, thanks for the post



No problem, the PHP codes only will work in the PHP file that cutenews is integrated into. You cannot put it in the Default.tpl.
I wish they can update the tpl functions, but as of right now, it's sort of weird to do so.

Hope this works.
Go to the top of the page
 
+Quote Post
nicol
post Feb 19 2013, 11:26 AM
Post #3


Newbie
*

Group: Members
Posts: 1
Joined: 19-February 13
Member No.: 89,854



Looks like this is what you are looking for: http://www.likebtn.com
Go to the top of the page
 
+Quote Post
Gonzalez Rivera
post Feb 21 2013, 06:53 AM
Post #4


Newbie
*

Group: Members
Posts: 7
Joined: 13-February 13
Member No.: 89,451



Before I was applying PHP Codes on default.tpl files but thanks to you who guide me to avoid this code because PHP functions not applies there. SEO Consulting

This post has been edited by Gonzalez Rivera: Feb 23 2013, 08:17 AM


--------------------
Social Media Agency London
Go to the top of the page
 
+Quote Post

Fast ReplyReply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 21st May 2013 - 06:02 AM