SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    adding php to Html documents

    Hi,

    I have no previous experience with php and I'm not sure what is possible, and what isn't, so please
    bare with me.

    I run phpbb2 forums at this address:

    http://www.alteredskate.com/forums/

    I tried to add a hack that allows visitors to my main page to view recent posts to my forums. The hack and
    instructions are located here:http://freedomfighters.dns2go.com/?go=S01

    The sample page worked correctly:
    http://www.alteredskate.com/visions_sample.php,
    but when I added the code to my site to test it out:
    [URL=http://www.alteredskate.com/index1.html]
    http://www.alteredskate.com/index1.html,
    nothing showed up under the headline "Most Recent
    Posts" .

    Does anyone know why it wouldn't show up? Can php code
    be directly placed into an html page like I did? Thanks.
    Last edited by alteredskate; Jan 7, 2002 at 21:17.


  2. #2
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you have 2 choices: either switch that page to .php (name it index.php), which would be best. or have .html files parsed for PHP, because they aren't by default. to do that, if you're using Apache, put this in a .htaccess file:

    AddType application/x-httpd-php .html

    but, it would be better to just make the file .php if you can.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the answer. but like I mentioned earlier, I haven't a clue about php.

    With that said, can I simply rename the index.html to
    index.php and have it work?

    Will browsers accesseing www.alteredskate.com automatically get the index.php file, or will they be looking for the index.html file instead?

    Hmm..actually that wouldn't be very good, because I would have to update links on all of my pages.

    Could you go into a little bit more on the .htaccess
    file please, because I didn't quite understand.
    Last edited by alteredskate; Jan 7, 2002 at 21:46.


  4. #4
    What's HTML?
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    1,701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by alteredskate
    With that said, can I simply rename the index.html to
    index.php and have it work?
    Yup, that will work fine. You should also delete index.html so browsers will go directly to index.php when accessing your domain.
    Ryan Kuhle - A Proud Advisor - Got Questions? Just Ask!
    Get your website started for less than $20! Click Here

  5. #5
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. it's all working now.


  6. #6
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by alteredskate
    can I simply rename the index.html to
    index.php and have it work?
    yes, as has been said.

    Will browsers accesseing www.alteredskate.com automatically get the index.php file, or will they be looking for the index.html file instead?
    probably. it depends on if the server is setup to use index.php as the default document.

    Could you go into a little bit more on the .htaccess
    file please, because I didn't quite understand.
    sure. as long as your server is using Apache, create a file called .htaccess in your Web root and put the text that i posted in it. then it should parse HTML files for PHP.

  7. #7
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh, i see it's working. what about changing your links?

  8. #8
    SitePoint Zealot pnathan's Avatar
    Join Date
    Sep 2001
    Location
    Amsterdam
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I know to make browsers pick up "index.php" as your default page, you need to tell the web server to do this. You need to enable .php documents are default.
    I have two tickets to the Crows, sweet.


Bookmarks

Posting Permissions

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