Loading txt file in html

Discussion in 'Programming' started by kazisahab, May 21, 2009.

  1. #1
    i hv figure to make u understand .. what in my head

    [​IMG]

    p.s its been years since last i read or did near developing so i need a push or a powerful kick :chomp:
     
    kazisahab, May 21, 2009 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    Template Driven Programming comes in the scene.
    Now you have few simple and one best method.

    Example 1.

    Linktxtfile.txt
    Product Title 1
    Product Description
    Product Price


    Mixed HTML / PHP Page

    <?
       list($title,$desc,$price) = file("Linktxtfile.txt");
    ?>
    <h1><?=$title?></h1>
    <i><?=$desc?></i>
    <b><?=$price?></b>(USD)
    HTML:

    Example 2.

    Linktxtfile.txt
    Product Title 1
    Product Description
    Product Price


    HTML Template - template1.tpl

    <h1>$title</h1>
    <i>$desc</i>
    <b>$price</b>(USD)
    HTML:
    PHP Page
    <?
       list($title,$desc,$price) = file("Linktxtfile.txt");
    
       $data = file_get_conents("template1.tpl");
       $data = addslashes($data);
       
       #repeat this for each template either header / footer etc
       eval("\$display = \"$data\";");
       print $data;
    
    ?>
    PHP:
    I hope you can adopt any of these methods.

    regards
     
    Vooler, May 22, 2009 IP