Code to get File Date Info at Display Time

Phoca Download - download manager
jmiller121
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Nov 2009, 22:34

Code to get File Date Info at Display Time

Post by jmiller121 »

Hi,

Due the size of my files, I upload them via FTP, updating them every several weeks. However, PhocaDownload does not automatically update the File Date when a new version of an existing file is uploaded. I would like to have PhocaDownload check the File Date at display time, similar to what it does with the file size. Does anyone have example/sample code of how this would be done?

Thanks for your help!
JMiller
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Code to get File Date Info at Display Time

Post by Jan »

Hi, there is no such feature, added into a feature request list. :-(
If you find Phoca extensions useful, please support the project
jmiller121
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Nov 2009, 22:34

Re: Code to get File Date Info at Display Time

Post by jmiller121 »

Hi Jan,

Thanks for the reply...

I've sort of found a way to do what I want it to do using the filemtime function...

In the /components/com_phocadownload/views/category/tmpl/default.php file, I changed the lines that say this:

Code: Select all

if ($valueDoc->date != '') {
	$details .= '<div>'.JText::_('File Date').': '.JHTML::Date($valueDoc->date, "%B %d, %Y").'</div>';
}
to this:

Code: Select all

if ($valueDoc->filename !='') {
	$absFile = str_replace('/', DS, JPath::clean($this->absfilepath . $valueDoc->filename));
	if (JFile::exists($absFile))
	{
		$details .= '<div>'.JText::_('Last Updated').': '.JHTML::Date(filemtime($absFile), "%B %d, %Y").'</div>';
	} else {
		$details .= '<div>'.JText::_('File Date').': '.JHTML::Date($valueDoc->date, "%B %d, %Y").'</div>';
	}
}

It works for me, hopefully this code will be somewhat helpful to others...

Regards,
JMiller
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Code to get File Date Info at Display Time

Post by Jan »

Thank you for this info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply