Hi

I have develop an online catalog in php/mysql. Now the client needs the web site on a cd. Of course without php or mysql...

What is the fastes and easiest way to convert the only 2-3 dynamic php pages into static html files?

Of course I could copy the html code generated by the php pages for each product and save it as different product1.html product2.html ... but that will take ages ... 2000 products in 2 languages.

Is there a way to redirect the output of php pages to a file instead of to the screen? So I could create a simple php script that loop for each product & languages to generate all the pages.

I read a few posting on the subject but as a newbie I am not sure to understand the principle 100%.

What I would really appreciate is a clear receipe on how to write a loop script to create my 4000 static html pages based on my existing dynamic product page which is a mixture of php & html coding. The menu & index pages are not a problem as I can copy their code from the browser itself (at least for this urgent job).

Thanks for copying your post to my email paul@gondwanastudio.com.

    Look for wget. It can do what you want.

      Can you be a bit more specific? wget is not a function? Where do I search?

        wget is a *nix program ( thought might be available for Windows too ) which mirrors webpages and websites. You could use that.

        You could also use ob_start(), ob_get_contents(), and ob_end_clean() to store the contents all your output ( print, echo, etc. statements ) into a variable, and then fopen, fwrite, and fclose those contents to a static HTML file.

        -- start of file --
        ob_start();

        // all the contents of your page here

        $OUTPUT = ob_get_contents();
        ob_end_clean();
        $fp = fopen ($_SERVER['PHP_SELF'] . ".html", "w");
        fwrite ($fp, $OUTPUT);
        fclose ($fp);
        -- end of file --

        Thats completly psudocode, untested. But you get hte idea.

          A zsh shell for Win32:
          [url]ftp://ftp.blarg.net/users/amol/zsh[/url]

          Whoa, cool! Anybody use that?

            Write a Reply...