www.webdeveloper.com
Results 1 to 4 of 4

Thread: CAn I have a PHP subdirector in an HTML site?

  1. #1
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    330

    Question CAn I have a PHP subdirector in an HTML site?

    i'm about to convert my site from XHTML 1.0 Strict to PHP.

    Also, I'm building a tiny site for a friend, as a surprise, for Christmas, I hope; don't know if I'll make that date; it'll be PHP.

    What I want to do is put up a subdirectory for this friend (actually, it's already there, but it's in XHTML 1.0 Strict; I can wipe it out, and start again with PHP).

    So, can I have a structure like this:

    My regular site:

    /www

    all pages and subdirectories contained here.


    /www/highgarth

    with highgarth in PHP instead of XHTML

    Would that work?

    If so , how do I implement that?

    Thanks!

    Mon, 19 Dec 2005 17:09:26
    My site is my home-and-playground
    http://www.coherentdog.org/
    Carol W

  2. #2
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    Well anything with the extension .php will be parsed as PHP and anything with the extension .htm or .html will be served as text/html without being parsed. So you should be able to just create the directory and start PHPing, assuming your host supports PHP.

    By the way, you know that the PHP should still output (X)HTML, right?
    Last edited by David Harrison; 12-19-2005 at 07:56 PM.
    Every fight is a food fight when you’re a cannibal.

  3. #3
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    330
    Dear David,



    Oh! Great! Then before I tackle the full editing of my c150-page site, I could use the site I'm building to test with; whew! Gosh, and when I tackle my own site, I can have some pages conversted to PHP and others not, and they should still work EXCEPT - for the links - come to think of it, I don't think the links would work right, so I'd better edit my entire site before uploading it to my host, so the links work!

    However, the one I'm building for my friend only has one page (and no content yet), and only about 7 pages planned to begin with, and that one, I can put into PHP in a subdirectory; it isn't linking to my own regular site (yet). So no problem there, I guess! This is wonderful; I can try it out to see how it works, which will make my editing easier.

    Umm, I'm not sure exactly what you mean by that last sentence, but I went to the PHP home page and began reading their tutorial, and very early there, I see that you can put PHP into an (X)HTML page, and go back and forth, and I think I vaguely get the idea of what you're talking about. I was glad to see remarks in the PHP tutorial about maintaining (X)HTML standards, because the W3C Validators are my lifesavers, along with these forums.

    I also tried validating a PHP page, and got an error message, but when I renamed the same page from index.php to index.htm, without changing a thing n the page, the W3C Markup Valadator accecpted that, so I guess I can validate locally on my own machine, before upload to my host, using that method.

    Oh - so I guess yes, I did know that - that is, that I can just use my XHTML 1.0 Strict pages, leaving the document type intact, and converting only any bits of code that run little scripts. (Is that right? I think so.)

    Mon, 19 Dec 2005 18:20:31
    Last edited by David Harrison; 12-19-2005 at 08:45 PM.
    My site is my home-and-playground
    http://www.coherentdog.org/
    Carol W

  4. #4
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    Well since PHP is a server-side language, when it's finished running, only (X)HTML is sent to the browser. So even if you use PHP, the browser will still end up with your XHTML Strict, except that the file will be called .php.

    Yeah, you can use your existing pages and just insert PHP into them which will run before anything is sent to the browser, but unless you have a .htaccess file that tells the server to parse .html pages for PHP, all the files will need to be renamed to .php.

    Edit: I think I must be a bit tired, I just edited your post instead of posting a new reply , luckily I could restore your post though. Think I better go to bed before I cause any more damage.
    Every fight is a food fight when you’re a cannibal.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles