Clear questions and runnable code
get the best and fastest answer
Uniquely identifying each & every html templateby Nik
|on Jan 21, 2013 at 12:25 UTC||Need Help??|
Nik has asked for the
wisdom of the Perl Monks concerning the following question:
I use this .htaccess file to rewrite every .html request to counter.py
counter.py script is created for creating, storing, increasing, displaying a counter for each webpage for every website i have.
It's supposed to identify each webpage by a and then do it's database stuff from there
It works as expected and you can see it works normally by viewing: http//superhost.gr (bottom down its the counter)
What is the problem you ask?!
Problem is that i have to insert at the very first line of every .html template of mine, a unique string containing a number like:
index.html somefile.html other.html nikos.html cool.html to HELP counter.py identify each webpage at a unique way.
Well.... its about 1000 .html files inside my DocumentRoot and i cannot edit ALL of them of course! Some of them created by Notepad++, some with the use of Dreamweaver and some others with Joomla CMS Even if i could embed a number to every html page, it would have been a very tedious task, and what if a change was in order? Edit them ALL back again? Of course not.
My question is HOW am i suppose to identify each and every html webpage i have, without the need of editing and embedding a string containing a number for them. In other words by not altering their contents. ============================================== BEFORE you answer me consider the following specification please: An .html page must retain its database counter value even if its: (renamed && moved && contents altered) ============================================== original attributes of the file:
contents: <html> Hello </html>
get modified to:
contents: <html> Hello, people </html>
The file is still the same, even though its attributes got modified. We want counter.py script to still be able to "identify" the .html page, hence its counter value, in order to allow it to increase properly.
Thank you ALL in advance for your help.
p.s. The above i'am trying to implement with Python, so sorry for not being a Perl question, BUT, i need your ideas on which method solves this specific problem. Later on, it this will be a coding issue, for now its just a specification issue. Thank you all in advance.