Page 1 of 1

Code to get File Date Info at Display Time

Posted: 16 Nov 2009, 04:04
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

Re: Code to get File Date Info at Display Time

Posted: 16 Nov 2009, 19:56
by Jan
Hi, there is no such feature, added into a feature request list. :-(

Re: Code to get File Date Info at Display Time

Posted: 19 Nov 2009, 16:32
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

Re: Code to get File Date Info at Display Time

Posted: 23 Nov 2009, 00:18
by Jan
Thank you for this info.

Jan