如何存储自定义页眉

Another 'design' question.

(Technologies in use: PHP, MySQL)

I need to allow customers to customize the looks of their pages' headers. What is the best way to store such customized headers (say pieces of html closed in a div). Is storing them in database any good?

Or would it be better to store them in php files and include them to each page instead of default header?

Or perhaps allowing users to edit html is a very bad idea and I should use some other means for allowing them to customize their headers? (mostly they use it to put a logo + some additional information, sometimes animated gif with advert, sometimes just text... no rule).

Please advise.

Storing them on the local filesystem is the most performant and simpler one, so you may want to go with this one.

However this will not be as good once you have to scale on multiple servers. The better solution then is to use some kind of shared storage (the mysql database solution), and to eventually cache the templates somewhere.

Html in a database is bad practice it might brings encoding issues (not too hard to resolve but still, a pain in the a##).

what you should do is define the level of customization you want to achieve and create the php classes that will allow you to create such a customized header from your code. You will then have to store in your DB the values needed to rebuild this header on the fly.