Update most important book articles to follow the best practices

| Q   | A
| --- | ---
| Doc fix? | yes
| New docs? | no
| Applies to | all (or 2.6?)
| Fixed ticket | lots of complaints :)

I've decided to do only the most important articles for the first PR, otherwise the diff will be too big to get a nice review. I'll do a seperate PR for the Page Creation article, since that needed quite so rewriting.

Btw, I also couldn't resist to fix other minor things :)
In most of the PHP template examples, we use the semicolon after `endif`, `endforeach` and so on. I'm not sure if we better avoid it in general or keep it at all.