there is a concept: active pages, dynamic pages as opposed to static pages, that is involved with what you’re asking, and is not restricted to php. php is only one of the many ways to have static html content become active, dynamic, with the help of the server side technologies.
As guido alluded to earlier a .php file is essentially a .htm file with php code inside of it.
I’ll summarise quickly what normally happens.
Say you have a plain vanilla html file with some optional javascript and css.
When someone points to that page on your server, the web server sends the html file back to the requestors browser and the browser processes the html, javascript and css and eventually displays your web page’s content in their browser
Say you now have some php code as well in the same html file as in 1).
The file should now have a .php extension. This .php extension tells the web server that when someone points their browser to that .php file, the server should first send that php file to the php “engine” on the server. The php engine then reads through that php file line by line and ouputs any html, js,css code unaltered and processes any php code between <?php ?> tags as it comes across them. Any output from the php code is then inserted in place of the php code in the original php file. When the entire .php file has been read and processed by the php engine, the resultant output , which is now just plain html with the original js, css and output from the php code is sent back to the requestors browser and processed by the browser as in 1).
You don’t need a header with .php, nor do you need to optimize meta tags, titles, or anything else. Focus solely on keeping your site content fresh, and everything else takes cares of itself, by itself…
So I can think of a .php file as a large “bucket” where I can dump in HTML, CSS, Javascript, etc and I can start off with any type of HTML or XHTML header and then just insert PHP later on below the header and everything will be okay?
(If my first few lines are like the HTML header shown above, I assume you could put PHP before that, right??)
No need for a php header. The .php extension will tell the server that the file has to be passed through the php parser before sending the data to the client (browser). Inside the php file, you can have a mix of (x)html, css, javascript, and php code. After the php code has been executed, the result will be a pure (x)html/css/js document, and that will be sent to the client.
So yes, you can start the file off with a HTML header.
Just keep your site content updated. Basically, that’s what I was saying. No need to optimize meta tags, headers, and keywords and all that stuff. Just stick to the basics…
I love that concept, and yes… basically the file is a bucket. With a .html file you can stick your HTML, CSS and JavaScript inside (though separating structure, style and behaviour is the best option, so I recommend having JavaScript in a JS file and CSS in .css files!) but if you’re pages have a .php extension you can literally embed PHP code directly into the HTML within the file and it’ll run like magic. Basically the .php is a .html with PHP able to work inside.