How can I make html files in PHP?

Discussion in 'Programming' started by rdlrn19, Mar 8, 2009.

  1. #1
    Hi

    I need to do html files using PHP code.

    Someone knows how to do this?


    Thanks in advance :)
     
    rdlrn19, Mar 8, 2009 IP
  2. fairuz.ismail

    fairuz.ismail Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    sorry but idont understand your question..

    maybe you want to output html tags in php statement like this?

    echo "<h1>Hello World</h1>";
     
    fairuz.ismail, Mar 8, 2009 IP
  3. rdlrn19

    rdlrn19 Peon

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    No, I mean I'm doing a form where the articles are added, so after the articles are in my BD, I need to create a HTML file with the name of the article.

    For example:

    If my article calls: how to lose weight

    I want to create a HTML page call "how-to-lose-weight.html"
     
    rdlrn19, Mar 8, 2009 IP
  4. Joak1m

    Joak1m Peon

    Messages:
    135
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    fopen(how-to-lose-weight.html, 'w')
    PHP:
    ?
     
    Joak1m, Mar 8, 2009 IP
  5. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #5
    $f = fopen('how-to-lose-weight.html', 'w');
    fwrite($f, "YOUR HTML CONTENT HERE");
    fclose($f);

    Article on it
    http://www.apitalk.com/document.php?id=1184208074_5

    Besides if you think the dynamic contents driven sites on net are writing html files, then you might be doing wrong, because it is the SEO (Search Engine Optimization) they do for pointng certain script. The urls seeem html files but actually they are not, they ar just pointers.

    For example:
    http://www.mysite.com/article-my-new-laptop.html

    is basically (behind)
    http://www.mysite.com/article.php?id=my-new-laptop

    I hope it helps.
     
    Vooler, Mar 9, 2009 IP