PHP is a scripting language, the output of which is HTML code and content.
Includes are fairly simple, but you first need to tell your server that the script files on your server need to be sent to the PHP handler instead of being just sent directly to the user's browser.
You do NOT have to change the URLs that are used to access that content. In fact it is a very bad idea to change the URLs. There's several ways to achieve that, documented in a number of threads here.
Includes are great, because you can use the same code fragment on every page of your site. When you need to change that common code, it is just one small edit - and that change appears immediately on every page of the site.
|I've gone to various websites reading info on the subject but it seems I can't find a place that will start me right at the very beginning. I do not understand ANY of the verbage. |
Did you try W3Schools [w3schools.com]?
|My web site is css/xhtml. |
This is off topic, but I have to ask. If you're struggling with includes, you may be making things harder than they have to be just in your page production. Why are you using XHTML? If your output is going to be HTML, and your server outputs text/html headers, and you're not going to be digging into the wonderful features of XHTML and extending your html elements with a custom DTD, go easy on yourself.
Continue using CSS, but use a doctype that actually describes your web site content. Use a 4.01 strict or even transitional doctype. You won't need the annoying little /'s everywhere.
OK, just by the two replies I've learned something about PHP. This is a start.
Happy to hear I don't need to change any URLs.
Regarding the doctype...this doctype I posted is what my css/xhtml instructor said is the appropriate doctype for what I had just learned. I just believed him and put it there. I think I need to read further on the doctypes.
and you're not going to be digging into the wonderful features of XHTML and extending your html elements with a custom DTD, go easy on yourself.
Are you saying there is more to xhtml than I am probably utilizing? It's obvious I have some gaps in my understanding here.
I was intrigued by what I read about PHP and thought it could have a positive impact on my website. I've been to W3schools a ton for several aspects of learning web development. Looks like another trip to school.
Do a search for 'killer php', I found the video tutorials were great for the basics
tomhumf- Thanks for the suggestion. That is exactly what I was looking for. I've watched several of the video tutorials and they are very easy to understand and answered many questions already.
I have a couple of questions here before I pursue this further. Learning something new can take alot of time, something of which I don't have much of currently.
If I decide to incorporate php script into my site at this point it would be only for file includes on every page and an 'email contact us' form on one page.
My question is, using this new script will I be changing all my file extensions over to php or keeping them html? Is there some drastic change I'll need to make to my html site to be able to incorporate these cool funtions with php. OR, am I able to just add the php script into my html and keep everything as it is? Am I making sense?
|Are you saying there is more to xhtml than I am probably utilizing? It's obvious I have some gaps in my understanding here. |
Sorry for the off-topic, this is the last I'll divert your thread. :-) It's not just you. Developers claiming to be "experts" don't even know this, or ignore it.
Many developers, including "instructors," give a knee-jerk answer to doctype with XHTML as the "latest and greatest, it's the replacement for HTML." People just accept this and go with it without knowing why other than someone somewhere told them it was so, so it must be. When you have a moment, read this thread posted by DrDoc Why MOST of us should NOT use XHTML [webmasterworld.com] and this excellent FAQ by encyclo: Choosing the best doctype for your site [webmasterworld.com]. Then go kick your instructor's patootie for not knowing these. :-)
|using this new script will I be changing all my file extensions over to php or keeping them html? |
It might be simpler to convert them all to .php so you know "what is what," but you can change your server configuration to parse all .html extensions as PHP.
- change your server configuration so that it will look inside .html files for PHP scripts. You keep on using the same .html URLs as before.
- change the filenames to .php and carry on using .html URLs. Set up a rewrite to connect .html URL requests to be handled by .php files. You keep on using the same .html URLs as before.
Do NOT change your URLs from .html to .php as that would be a major setback to the indexing of your site.
Dump the XHTML DOCTYPE and go with HTML 4.01 - either Transitional or Strict will be fine.
Excellent responses from all, I'm changing the doctype for sure. I read the suggested thread by DrDoc and it's very informative. There's always something new to make me think or change the way I think about my new skill (some what not really quite there yet skill)...this web development moves forward very fast and is ever changing.
Glad I don't have to change my URLs. whew.