The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> facebook icons
MindyT
post Jan 26 2016, 11:25 PM
Post #1


Advanced Member
****

Group: Members
Posts: 165
Joined: 12-November 13
Member No.: 19,963



Hi, the following code comes from a function file. I'm trying to add a facebook icon and I got the code but since it is in the PHP File I'm not familiar with how quotes work in Javascript. I tried escaping the quote after the script end tag but that wasn't the problem.

CODE

       echo "<div class=\"footerInfo\"> <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/sdk.js#xfbml=1&version=v2.5&appId=360259960669567";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>";
      echo "</div>";


This post has been edited by MindyT: Jan 26 2016, 11:27 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jan 27 2016, 10:14 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,665
Joined: 10-August 06
Member No.: 7



This looks like a PHP issue. Since the PHP string begins and ends with double quotes, all other double quotes inside the string must be escaped with backslashes (otherwise PHP thinks the string ends there).

There might be other issues, but try this first.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Sam A
post Feb 15 2016, 05:27 AM
Post #3


Novice
**

Group: Members
Posts: 26
Joined: 22-April 15
Member No.: 22,515



I think it may the problem with php code. There may multiple instruction repeatedly runs in that code.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 11th May 2024 - 09:21 PM