If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

But sometimes displaying a text file in an iframe can fail. If you rename it to counter.htm (make sure to also change wherever it's referenced in the other code, so it gets updated), then there should be no problem.

Using AJAX for this is complicated, and really a bit of overkill for such a simple piece of information unless you already have jQuery on the page, in which case it's fairly simple to load the contents of the counter file into a div element on the page. Again, it would be best if it were a .php or .htm file, but probably less critical than with iframe.

I wouldn't say it's generally a bad idea to parse PHP in HTML. It makes the server work a little harder, yes, and it may create a bit of confusion with the organisation of files if somebody is expecting to see HTML in an .html file and PHP in a .php file (although with internal CSS and JavaScript already in HTML, and HTML in PHP, what's a little PHP in HTML going to do to the confusion level?), so I suppose the answer would be "it depends". To be honest, most of the web hosts and server environments I've worked on in the last 10 years had been setup to parse PHP in HTML files by default and I haven't had to fiddle with .htaccess at all. Maybe that's because they're private servers, semi-dedicated servers and "pro" level accounts on shared hosting though? It could be that more basic level shared hosting doesn't allow it.

I'm self-taught, I know - doesn't inspire confidence ;-)
and new to html/css & javascript (but from a C64 generation and with some success using C#). PHP scares me a little.
I found your second post, well commented code, extremely useful, inspiring... and with tinkering it works!

I had to rename my .html page as .php (my host?) and keep the html download on the page (or the .php didn't return to the download page).
I will explore why ... but supplying a simple useable code for counting downloads has been very kind - thank you again!