-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPF.js doesn't return responses when we have multiple lines! #438
Comments
White space doesn't affect the DOM, so I doubt that's what's causing your issue. Can you post a jsfiddle with an example of your code not working? |
I'm trying to integrating SPF.js with Laravel. Here is my structure:
head.blade.php
body.blade.php
foot.blade.php
index.blade.php
As you can see everything is solid and clear in my structure but this is not working until I manually replace all Like so: head.blade.php
body.blade.php
foot.blade.php
It works but I don't like it! it makes my code messy ... Any ideas? |
I think the issue is in "index.blade.php". These lines:
are instructing PHP to inject the contents of the other files, in line. So if "users-list/head.php" contained this string:
Which of course is not what you intended. See if you can find a method in PHP for escaping string values for use in JSON. Perhaps this? http://php.net/manual/en/function.addslashes.php |
You are right about slashes. But I can't understand why it only works when I put all lines into one line! If I don't it won't work! |
Yes, same issue. If "users-list/head.php" contained this:
You would end up with this output:
Which is also invalid JSON (see "string" section of JSON definition). If you're able to find a method to load a file in PHP and escape use the "addslashes" method it will also convert newline characters to something acceptable for a JSON string (which is the 2-character string "\n"). |
Thank You, I've provided a Laravel Package. laravel-spfjs |
SPF.js doesn't work with this:
But if I put all lines into one line it works fine. Like this:
<link rel=\"stylesheet\" href=\"css/style1.css\"><link rel=\"stylesheet\" href=\"css/style2.css\"><link rel=\"stylesheet\" href=\"css/style3.css\">
Why SPF.js doesn't work in multiple lines?
The text was updated successfully, but these errors were encountered: