From: Joel Goldstick on
� wrote:
> Hello dear Pythoneers,
>
> I have over 500 .php web pages in various subfolders under 'data'
> folder that i have to rename to .html and and ditch the '<?' and '?>'
> tages from within and also insert a very first line of <!-- id -->
> where id must be an identification unique number of every page for
> counter tracking purposes. ONly pure html code must be left.
>
> I before find otu Python used php and now iam switching to templates +
> python solution so i ahve to change each and every page.
>
> I don't know how to handle such a big data replacing problem and
> cannot play with fire because those 500 pages are my cleints pages and
> data of those filesjust cannot be messes up.
>
> Can you provide to me a script please that is able of performing an
> automatic way of such a page content replacing?
>
> Thanks a million!

This is quite a vague description of the file contents. But, for a
completely different approach, how about using a browser and doing view
source, then saving the html that was generated. This will contain no
php code, but it will contain the results of whatever the php was doing.

If you don't have time to do this manually, look into wget or curl,
which will do the job in a program environment.

The discussion so far has dealt with stripping php, and leaving the
html. But the html must have embeded <?php some code to print something
?> in it. Or, there could be long fragments of html which are
constructed by php and then echo'ed.

Joel Goldstick