Re: Code help - file parse?

From: Date: Sat, 31 Jan 2004 03:10:24 +0000
Subject: Re: Code help - file parse?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176436@lists.php.net to get a copy of this message
john wrote:
Looking for code help: When my php script inserts data into the database I'd like to parse an html page for a date and replace it with the current date. This way visitors to the main html page can see the last time the database was updated. I know I could re-write the html page using php but would rather leave it html. Anyone have code to parse and replace based on a hidden tag? Thanks
It can be as simple as opening the file, reading the file, looking for the "hidden tag" with a regular expression while writing to a temp file line by line, and if all that happens with no errors, replacing the html file with the temp file. Simple, just a few steps involved, eh? Me thinks is would be easier to rename the file from a html extension to a php one....leaving all content as is....just rename....and using one little sniplet of php to output the date in the document. -- By-Tor.com It's all about the Rush http://www.by-tor.com

« previous php.general (#176436) next »