Gossamer Forum
Home : Products : DBMan : Installation :

Last modified date on db file

Quote Reply
Last modified date on db file
Is there a way to display a "last modified date" of the database file to the page's viewer? I can't figure out how to do it without SSI files.

------------------
Wayne Hunt
Amiga.org
http://www.amiga.org

Quote Reply
Re: Last modified date on db file In reply to
How about:

my $date = localtime((stat($db_file_name))[9]);

and then use $date where you want to print it.

Cheers,

Alex
Quote Reply
Re: Last modified date on db file In reply to
Thanks Alex,

Your tireless effort and speedy reply is greatly appreciated.

Wayne Hunt


------------------
Wayne Hunt
Amiga.org
http://www.amiga.org

Quote Reply
Re: Last modified date on db file In reply to
I would like to add this Last Modified date to our database also - however,I do not know what page this would have to be added to or where?
Quote Reply
Re: Last modified date on db file In reply to
It would depend on where you wanted it to appear. My suggestion would be to have it in html_home -- a line like

print "The database was last modified on $date."

This assumes, of course, that you have already defined the $date by using the code that Alex gave.

------------------
JPD





Quote Reply
Re: Last modified date on db file In reply to
Actually I would I want it to show the "Last Modifed Date" of each record, not the last time the database was modified.

I still do not know where the code that Alex wrote would need to be placed? I am currently using the default DB but have erased all data that was curently in it. I have also modified the fields and do have a "Last Modifed" date field that pulls the date into the record.... however, I cannot get it to add the "Last Modified" date to the record.

Thanks for all your help and a great product thus far !
Quote Reply
Re: Last modified date on db file In reply to
If you wanted to use the code Alex gave for the last date the database was modified, you just need to put it anywhere before you use the $date variable, as long as it's not within a print statement. I'd put it in html_home, before the first time I see print qq|

As for your last date the record was modified, is it that you're having trouble getting the date into the field? If so, you need to add this to html_modify_form_record:

after

if (!%rec) { &html_modify_failure...

add

%rec{'DateModified'} = &get_date;

Change "DateModified" to the actual name of your field.



------------------
JPD





Quote Reply
Re: Last modified date on db file In reply to
Yes I cannot get the modified date to show up in the record - the date remains the same as when record was first created.

Here is my code:

sub html_modify_form_record {
# --------------------------------------------------------
# The user has picked a record to modify and it should appear
# filled in here stored in %rec. If we can't find the record,
# the user is sent to modify_failure.

my (%rec) = &get_record($in{'modify'});
if (!%rec) { &html_modify_failure("unable to find record/no record specified: $in{'modify'}"); return; }
%rec{'Last Modified'} = &get_date;

&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: Modify a Record.</title> ........