php

How to convert php file into html file


I'm a frontend developer and I'm facing with a problem.

Whenever I'm building a website, I'm using PHP to include the template files, so I get a redundant code. But when I want to generate this file into an HTML file I open up the PHP file in the browser to copy/paste the code to an HTML file.

How can I make this process to be way much faster, or how could I avoid to do these things manually? Maybe there is a program to do this or something?


Solution

  • You can use a recursive wget.

    Say your webserver runs on your localhost, you can run:

    wget -r -k localhost
    

    Be careful: wgetdoes not perform a search on which pages are available, it simply looks at links (the <a> tags) and will capture these as well. As long as everything is reachable from the index page (not necessarily on the index page), it will be downloaded.

    wget is a linux program, but I guess there is a Windows application with the same name/options as well... As @rkbvkleef points out, it's part of the MinGW package.