Just learned something unrelated to Lego I thought I’d share:
Programming languages are REALLY strict!
When not building Lego, collecting Lego, or reading about Lego I build websites. Currently, I’ve been working with WordPress a lot. In the natural progression of things, I decided I wanted to learn more. I wanted to learn how to write my own plugins.
I found some tutorials, and when I was finally ready to test my first plugin, it kept bombing out on me. I kept getting this error:
Warning: Cannot modify header information – headers already sent by <some file>
All I was trying to do was add a simple comment line in the <head> of the page. After several hours of comparing my code to the tutorial, research, and hair pulling I finally found the problem. I had a couple of extra blank lines after my closing php tag (?>).
SRSLY???
And to make matters worse, I noticed one blank line is fine. Two blanks lines, you’re looking for trouble.
SMH
Any way, thought I’d share. Hopefully some young enterprising programmer with the same issue in the near future will find this thread, and save some time!
I am an Adult Fan of LEGO (AFOL) and an active member of the Michigan LEGO User Group (MichLUG). I have loved LEGO for as long as I can remember. I am currently working on the following models:
– UCS Millenium Falcon
– Emmett’s Apartment Building
– Gringott’s Bank
Welcome to the world of PHP coding and WordPress. Once you get the basics sorted the rest comes easily. We’ve written many plugins over the years and are still learning all now about new hooks and actions. Writing your own WP plugin does open up a massive world of opportunity though 🙂
Ah, a kindred spirit! Any advice you can offer will be most appreciated!
So what kinds of plugins have you created? I do have an idea for one once I get some more basic understanding under my belt.
It felt good to accomplish this simple task yesterday. I haven’t had to sit and code like that in a while. I’m a little rusty!
That is interesting, logically it doesn’t wholly make sense to why that extra line space makes a difference, but good to know
The problem is related to what I was doing being in the
of the document. I know there are certain rules about what can be sent to the browser when. Apparently I need to go back and re-learn that bit.