1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

I need some PHP help

Discussion in 'Programming Chat & Support' started by WorldWarIII, June 20, 2007.

Thread Status:
Not open for further replies.
  1. WorldWarIII

    WorldWarIII Guest

    I am trying to get some php put into my page. By using include to have content from another file be loaded... This way I can have the same content on multiple pages by just editing one thing and not using SQL. :)

    PHP:
    <?php
    include("latestupdatehacks.html");
    ?>
    When I place it, nothing is displayed. Also, I am trying to place this within a HTML page. I know I have the naming right. Any suggestions?
     
  2. n00b

    n00b Full Member

    /?> maybe? Just a suggestion since most html codes end with the same thing with / and such.
     
  3. Renegade89

    Renegade89 New Member

    The file your trying to include needs to be latestupdatehacks.php

    PHP Includes don't work for .htm/.html files they have to be .php format AND online they won't display on your computer.

    /'s indicate the end of a tag/code.

    .Renegade
     
  4. WorldWarIII

    WorldWarIII Guest

    Let me test that, thanks :)

    I know they wont display on my computer :D

    I tried that and it didn't really seem to work... I'm trying to put it into the HTML of the site so I don't have to convert it all. That way I can edit just the one file. But I have this in the hackupdates.php
    HTML:
    <li>CS:S - Epic Xtreme v1c<span class="winli"></span> (6.19.07)</li>
    <li>CS:S - Epic Xtreme v1b<span class="winli"></span>6 (6.18.07)</li>
    <li>CS 1.6 - Epic CS v0.3<span class="loseli"></span> (6.6.07)</li>
    And this in the area of my code

    PHP:
            <ul>
    <?php
    include("hackupdates.php");
    ?>
        </ul>
     
  5. Renegade89

    Renegade89 New Member

    Umm.. the easy way to use php includes is to change every .html page extension to .php then insert the include code its the only way too really. :p
    If you change the extension of every page to .php the html coding inside is still read as html therefore I don't really know whats wrong. :S

    .Renegade
     
  6. Renegade89

    Renegade89 New Member

    Umm.. the easy way to use php includes is to change every .html page extension to .php then insert the include code its the only way too really. :p
    If you change the extension of every page to .php the html coding inside is still read as html therefore I don't really know whats wrong. :S

    Perhaps it isn't working because:
    That file where this code belongs is .html instead of .php ?

    .Renegade
     
  7. WorldWarIII

    WorldWarIII Guest

    I got it fixed buddy, thanks anyways, I talked to my buddy in class.
     
  8. Krzywy

    Krzywy Moderator

    make sure that u will restrict what files should be included bcs RFI on that will be very easy :)

    RFI == Remote File Include
     
  9. Perkele

    Perkele New Member

    Hahahaha this is plain hilarious!
    A site admin without any scripting knowledge.
    You just made my day.
     
  10. N008

    N008 New Member

    warning given for insulting WWIII
    no-one can know everything
    show a bit respect
     
  11. RessourectoR?

    RessourectoR? New Member

    I don't see any insult here, he's right, it is hilarious.
    But look at me :p:p
     
  12. Renegade89

    Renegade89 New Member

    ROFL... your kidding right..

    .Renegade
     
  13. N008

    N008 New Member

    nope, i'm not
    if you got a problem with that, revoke it
     
  14. Auraiken

    Auraiken New Member

    Actually the easiest way to make html files be able to be included and 'parsed' with php would be to open your httpd.conf file (if you own/have access to the server) and find:

    AddType application/x-httpd-php

    It will be a line that looks like this

    AddType application/x-httpd-php .phtml .php3 .php

    Now we will include html files by changing that line to

    AddType application/x-httpd-php .phtml .php3 .php .htm .html

    That way you can now include php in any html files. Do the same if you want to run php in other file types.

    However, if you do not have access to the httpd.conf file you will have to change all the .html/.htm files you want parsed into .php files.

    You should just do this to all your files if you have the ability to run PHP scripts as the files will send html with it anyways. Just remember that PHP goes inside the <?php ?> tags and html should go on the outside.

    [ In-Depth Tip ]

    Unless of course you are using php to write the html via echo/print/printf functions. Normally you would keep html outside of php scripts unless the php script was used to make constructs like linking texts together

    ie. echo "Hey " . "there!"
    becomes "Hey there!"

    By keeping plain text outside of echo/print/printf functions you would be saving time loading by making sure the php doesn't parse through the useless text.
     
  15. Echo419

    Echo419 FS Owner

    by doing AddType application/x-httpd-php .phtml .php3 .php .htm .html

    thats making PHP parse an HTMl page as well. a waste and can cause many problems
     
  16. Auraiken

    Auraiken New Member

    Shouldn't be any worse than switching every file to php which would also make php parse through the crap as well.
     
Thread Status:
Not open for further replies.

Share This Page