Symfony2 renders template with blank line at top - symfony

My template starts with <!DOCTYPE html> on the first line, but for some reason when I view source on the page that's rendered, it starts on line 2.
This isn't a big deal in HTML, but I'm trying to render some XML and I'm running into the same issue, except XML isn't forgiving like HTML and must start on the first line.
EDIT
Thank you for the comments! I am a fairly new developer and was not aware of the BOM. That being said, I use PhpStorm, and you can just right click on a folder, then click 'Remove BOM', which I have done.
After doing that I ran this terminal command I found someone post grep -rl $'\xEF\xBB\xBF' that outputs files in the directory that have the BOM character. There were a few files listed, and I've fixed them all except /vendor/doctrine/orm/lib/Doctrine/ORM/Query/TreeWalkerAdapter.php. I've tried removing the BOM with PhpStorm, and haven't had any luck, so I opened the file with VIM and ran set nobomb like I found here: How do I remove  from the beginning of a file?, but it still comes out in the listing of the grep command above.

I faced the same issue, but because I closed my PHP file with "?>" and added some blank lines after. After removing the "?>", problem has been solved.
In this case nothing related to BOM directly (I was in UTF-8).
If this can help other people who find this post with the same issue than me.
See post : php: empty line from nowhere

Related

Wordpress site displays replacement character � in posts

Launched a new WP site about 1 month ago, and there were no issues at the time. Now there are instances of this character (�) inserting itself into posts. Looks to be happening where an open tag begins. Some sort of character encoding problem? Only happening in posts, not pages, so possibly a database issue?
You haven't copied and pasted the content from another editor like Word, have you?
It's encoding causing the problem, where Wordpress doesn't recognise the character you're using. If you hand code it rather than using the visual editor you shouldn't see it, and the most likely cause is inheriting the character from a piece of software that you have previously edited in.
Step 1) Open the wp-config.php file in a text editor such as notepad (the wp-config.php file can be found on the directory where you installed WordPress).
Step 2) Find the following two lines and comment them out:
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
They should look like the following after you comment them out:
//define('DB_CHARSET', 'utf8');
//define('DB_COLLATE', '');
Step 3) Now upload the updated wp-config.php file to your webhost (overwriting the old one).

Correct syntax for file path in background-image:url(''); in a twig file (building template for mautic)

I started to work with mautic (open source email marketing automation).
Im trying to build a template for a landing page and therefore I'm editing "*.html.twig" files. At least I could find out that twig is a PHP engine by Symfony. What I could not find out yet though is something actually totally simple, at least in css/html.
All I want to do is specify the correct file path to an image file as a background-image:url(''); within the style attribute of the body tag. (See example below)
How on earth is this twig working with file paths? It seems to automatically change the file path I specify, but in a way that is not comprehensible to me.
I tried several options, but the only thing that works at least partially is specifying the absolute path. As soon as I start using the template in mautic though and build a page from it and save it, even the absolute file-path gets 'crashed' on the output source code. What the heck?
I did not find much info on file path syntax in twig. What I found sounded so horribly complicated that I can't believe it should really be that complicated to simply put in a file path? Am I wrong?
Here is the example, specifying the absolute path in the actual source code.
<body style="background-image:url('http://sawiya.de/mautic/themes/mautictheme1/img/background.jpg'); background-color:#213E4C;">
When viewing the result in the browser, without adding content to the landing page template, the source code output is the following (path changed, but the result is at least that the image is being shown):
background-image:url(http://1.1.1.2/bmi/1.1.1.5/bmi/sawiya.de/mautic/themes/mautictheme1/img/background.jpg);
After adding content on top of the template in mautic, the file path is being changed even more and reads the following from the source code output (now the background image does not get displayed anymore, so its clearly broken):
background-image: url(http://1.1.1.3/bmi/sawiya.de/mautic/"http://1.1.1.5/bmi/sawiya.de/mautic/themes/mautictheme1/img/background.jpg")
What is this all about? Where can I get the info on how to easily and correctly specify the file path? Is it really that hard?
Ok, now I found out something strange. It might be a bug in mautic here.
When I open the page where I specified the image via the background-image:url() through the https:// -Protocol, instead of http://, it works!
And the resulting source code looks as expected:
background-image: url("http://1.1.1.5/bmi/sawiya.de/mautic/themes/mautictheme1/img/background.jpg")
So, wrong adress here, I think. At least to solve the bug. Hope someone finds this as a solution, until the bug is fixed.
Cheers!
Edit: Of course its better to specify the file path in a relative way, so that when the theme is used on another server, the path is still correct. In twig the best way to do that seems to be this. At least it works perfectly well.
background-image: url('{{ getAssetUrl('themes/'~template~'/img/logo.png', null, null, true) }}';)

Theme Check Both DOS and UNIX style line endings were found

I am using Theme Check to test my theme and I keep getting following error:
WARNING: Both DOS and UNIX style line endings were found in the file style.css. This causes a problem with SVN repositories and must be corrected before the theme can be accepted. Please change the file to use only one style of line endings.
Below is what I have tried to get this fixed:
I am using Notepad++ it has an option under Edit->EOL Conversion->UNIX/OSX Format, I have converted the file with that, it clearly says in the Status bar that it is UNIX.
I tried Editepad Lite 7 and tried to convert it to Unix.
I fixed only CSS prettifies to fix all the extra spacing (maybe there were any)
I even delete ALL lines of code with simple blank style.css file
but I am still getting this warning from Theme Check Plugin, I have no idea what I have to do with the file to fix this error.
Open the style.css file in Notepad++. I haven't used it in a while but there should be an option in File => EOL Conversions to choose the format you want.
Hope this helps!

I cannot log in my wordpress website

When I open my website link ,I found errors.The error is:
"Cannot modify header information - headers already sent by (output started at ...../wp-includes/pomo/entry.php:2) in /...../wp-includes/pomo/pomo.php(1) : eval()'d code on line 1".
And I cannot log in my website admin that shows plugabble.php errors.
How can I do that?
You need to troubleshoot whats going on...
Check plugin compatibility issues, deactivate plugind and see if it works
Another problem might be that you have gotten some text or whitespace [spaces or newline] before the opening PHP tag or after the closing PHP tag in your theme's functions.php file. There can't be a single character before or after those tags, check that...
Remove white spaces from other files, on wp-congig.php maybe...
Do your research on wordpress forums, the below link might help
https://wordpress.org/support/topic/cannot-modify-header-information-headers-already-sent-4
Its white space error or space in < ? ? > <? php etc.
so check again. also as per your notice check includes/pomo/entry.php:2 this file and see line no 2.
if there is extra space etc then remove it.
ALso if it will not solve then open function.php file of theme and remove space in bottom of the page.
or last step is remove space from wp-config file.

Brackets Code Complete Not working

I have installed Brackets with Tern Intelligence.
Inside my file Main.js, I type the following thing
Math.
And press ctrl-enter. I imagine I should see pow,max,etc, show up. What am I missing?
Code hints should appear automatically - no need to press anything. (If you do want to trigger them manually though, it's Ctrl-Space, not Ctrl-Enter).
What's in the rest of your Main.js file? If you make a new, blank JS file does it work? When I type Math. in an empty .js file, I see a list of code hints both while I'm typing Math and the appropriate list of options after typing the .
Also, try using Debug > Reload Without Extensions to make sure you don't have an extension installed that could be causing a problem.

Resources