views:

2410

answers:

3

First off, how do I know if my html file is running on localhost in Xampp? Is there a tutorial on how to manage files/directories and get that all working under htdocs? Is there a good tutorial on how to setup includes?

I want to use "includes" in Xampp with my html. Can I use both html includes AND php includes? Do I have to put shtml? Can I use shtml, html, htm, and php includes? Do they have to be in an includes directory that is a subdirectory right under htdocs? Can I reference includes in some other subdirectory? My site will have over 100 pages, and I am trying to do "experiments" with different versions until I am happy. So, I have subdirectories for the various drop down menus. Unfortunately, I don't seem to be able to get this working in xampp. Having trouble getting my javascript menus from Vista Buttons to show up, now that I moved my main directory for my site to the htdocs directory.

+1  A: 

To answer your first question, can you access http://localhost/? If so, then xampp is running correctly and there is nothing more that you need to do.

EDIT: If you want to ensure that things are working correctly, place foo.html under /xampp/htdocs and then access it in a browser at http://localhost/foo.html. If you can't get this page then xampp still isn't running correctly.

In answer to your second question, all Includes whether in the HTML or within PHP are server side. If you have xampp installed correctly, then you can begin working in PHP immediately and can use the include functions within PHP (please note that even if a page only contains HTML, if you're using PHP it must still have a .php extension).

If you would rather use SSI in your .html pages, then this link might provide some help on how to set up and debug SSI in xampp.

Additionally, if you are not already doing so I would recommend that you work in Firefox with Firebug installed. Firebug will handle most of your JavaScript debugging needs.

As a final note, if you've moved directories and the like, the first thing I would check would be the src attributes on your script tags.

Noah Goodrich
I can access http://localhost/, but how do I run my html on localhost? Is there somewhere I need to run from? or how do I tell the file to open on the local host? how can I tell where the file is running? Thank you!
James Musser
you put foobar.html in \xampp\htdocs .. and get it via http://localhost/foobar.html .. you can put folders under htdocs etc ..
Scott Evernden
A: 

You might want to look at AMPstart instead of xampp-control. It has some nice ability to allow you to place site-folders outside of htdocs w/o messing around with apache conf stuff

Scott Evernden
Loaded this but files still are not running on localhost.How do I run on localhost?
James Musser
if http://localhost doesn't get you the XAMPP page, you're stuck at GO. Is it a XP firewall problem maybe? You should have been asked to unblock Apache...
Scott Evernden
See my comment above under ans #1 .. you normally put your html in \xampp\htdocs . you can use AMPstart to put stuff in other places
Scott Evernden
A: 

I found out that for includes to work in XAMPP your page with the include function needs to have the extension '.shtml' while the included file has '.html'. Most modern browsers don't require the shtml extension but XAMPP seems to.

.js seems to be the same.