Pregunta

Question: I've read a lot of tutorials/books that have taught putting the header and footers into their own files and using php to include them in the content pages.

However, if you have javascript running in those headers or footers- isn't this "bad" design- or does it not really matter?

I guess I take out the javascript if it's not needed for a page and I don't really mind CTRL+C. However I can see the usefulness and efficiency of making a change in only one file instead of all of them.

¿Fue útil?

Solución

You should start using some template engine instead. Something to start with: Twig and Smarty

The most important feature you will like is called Template Inheritance

Otros consejos

I would always separate your header and footer files out, it is a nightmare otherwise!

Just load in the JS when you need it, if using PHP just check the $_SERVER vars - http://uk.php.net/manual/en/reserved.variables.server.php

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top