I have been working on content management systems for about 7 years. 2 years ago created my own. Currently building a newew, better and bigger version.
However, fell into dilemma. I have a core file, that gets included to all pages. Core file makes sure of adding functions, config, mysql connection etc. I also have added
Header("Content-Type: text/html; charset=UTF-8"); on the top of the code in the core file.
Recently I had to make a xml-generator, with
Header("content-type: text/xml; charset=UTF-8");. First, of course I couldn't get the xml working, because I forgot about my content-type setting in the core file.. Later I just added the content-type: text/xml after the core file include..
Basically everything works, but I wish polish this project to the finest.
So I'm thinking now, is adding the "content-type: text/html" in the core file, a good idea?
I had an idea, to include the core file like this:
include($rootpath . 'inc/core.php?content-type=xml');, then in the core file, the header will be set based on the
$_GET['content-type'].. Is that a good solution?