Results 1 to 3 of 3
  1. #1

    generate htm page using php?

    is it possible to use a php script to: use an htm page as a template, take the text from a textarea form and insert it at a specific place into the htm page,saving the new formed custom page as another htm page?
    what script could i use?

  2. #2
    Join Date
    Mar 2009
    Gods Own Country
    are you looking for some sort of template engine like smarty?

    If I understand you correctly, you easily do this using search and replace functions in PHP.

  3. #3
    Join Date
    Jan 2005
    UK, London
    Yea, a simple search and replace would work like this:

    my_template.htm - simple example
    HTML Code:
       Hello, my name is %name% and i am %age% years old!
    and you would process the above html file like this in PHP

    index.php - simple example
    PHP Code:

    // load the contents of template file
    $html file_get_contents('my_template.htm');

    // search for the following
    $search = array('%title%''%name%''%age%');

    // replace it with the following
    $replace = array('Personel Page''Latheesan'21);

    // do the actual search & replace

    // print the page
    echo $html;


Similar Threads

  1. Generate HTML/Static Pages from Dynamic Php Page
    By TheRealDeal in forum Programming Discussion
    Replies: 18
    Last Post: 12-18-2010, 09:28 AM
  2. generate an html page using php script?
    By andyxfun in forum Programming Discussion
    Replies: 1
    Last Post: 08-15-2009, 05:20 AM
  3. Changing the content of WHM generate page
    By desk2web in forum Hosting Software and Control Panels
    Replies: 1
    Last Post: 06-13-2006, 09:45 AM
  4. cannot generate SSL csr !!
    By dhecker in forum Dedicated Server
    Replies: 1
    Last Post: 06-28-2005, 11:45 AM
  5. How to generate
    By kooshin in forum Programming Discussion
    Replies: 8
    Last Post: 01-21-2005, 12:51 PM

Posting Permissions

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