1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Php Into .html ?

Discussion in 'Site & Server Administration' started by geekazoid, Aug 4, 2006.

  1. #1
    I have 100's of html pages and a php daily rotating random script.

    What i want to know is can i load this php page into a .html page ?

    Like include "http://www.phppage.com" into a .html page ?
     
    geekazoid, Aug 4, 2006 IP
  2. [*-AnOnYmOuS-*]

    [*-AnOnYmOuS-*] Active Member

    Messages:
    253
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Add this line in your .htaccess:
    Have fun :p .
     
    [*-AnOnYmOuS-*], Aug 4, 2006 IP
  3. kovacs

    kovacs Peon

    Messages:
    144
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Maybe it would be better to rename all of your pages into .php and use .htaccess to rewrite .html extensions to .php ...

    Just my 2c.
     
    kovacs, Aug 4, 2006 IP
  4. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ok after i have added this to my .htaccess thing then can i use

    <php? include "page.php"; ?>

    into a .html page?
     
    geekazoid, Aug 4, 2006 IP
  5. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ok brilliant now i have that working is there a way of putting .html files into a table on a .html page ?
     
    geekazoid, Aug 4, 2006 IP
  6. [*-AnOnYmOuS-*]

    [*-AnOnYmOuS-*] Active Member

    Messages:
    253
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #6
    You could use frames to add this, or you can use a php include/require() as php is now enabled in .html files ;).

    http://www.w3schools.com/html/html_frames.asp

    Hope I'm helping, and hope I would get some rep :rolleyes: LOL, just jokin :p , glad I helped.
     
    [*-AnOnYmOuS-*], Aug 4, 2006 IP
    geekazoid likes this.
  7. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I am trying to get a script which i can put on other peoples website. i have a .html file with my content on it but how do i put that on other peoples pages ?
     
    geekazoid, Aug 4, 2006 IP
  8. glennhefley

    glennhefley Peon

    Messages:
    73
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If I'm understanding you correctly you are trying to put HTML formatted information into someone else's website, by giving them a simple code to paste into their website page, which brings your HTML formatted information off your website, and into their web page design without breaking something.

    The code
    <?PHP include "http://www.mywebsite.com/myarticle.php"; ?> 
    PHP:
    is probably giving you an error something like Warning: main(
    p): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in ... blah blah blah..

    Files for including are first looked in include_path relative to the current working directory and then in include_path relative to the directory of current script. In other words, you are trying to use the wrong tool. PHP is not going to "include" a remote file.

    What you are looking for is fopen, fread, fclose and print.
    
    <?php
    // get contents of a file into a string
    $filename = "http://www.glennhefley.com/story_include.php";
    $handle = fopen($filename, "r");
    $contents = '';
    while (!feof($handle)) {
      $contents .= fread($handle, 8192);
    }
    fclose($handle);
    print $contents;
    ?> 
    PHP:
    This code would get the file, read the contents as given by the other server into a variable, and then print those contents. The contents will not be any PHP code you have in that file, only the out put text with HTML formatting which would normally be seen in the browser.

    Hope that helps you out.


    Glenn Hefley
     
    glennhefley, Aug 5, 2006 IP
    ramakrishna p likes this.