Access to file properties

Phoca Download - download manager
yurkir
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 23 Feb 2017, 10:07

Access to file properties

Post by yurkir »

Is it possible to have access from the front-end page to the file properties?
I mean those from General Options, like Title, Author and Version, as well as Downloads from Publishing Options.
Too lazy to modify the page each time file's version changes...
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48550
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Access to file properties

Post by Jan »

Hi, for now there is no such option so this needs to be customized for the frontend (add specific form inputs, etc.) :idea:

Jan
If you find Phoca extensions useful, please support the project
yurkir
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 23 Feb 2017, 10:07

Re: Access to file properties

Post by yurkir »

Come on, Jan. Even something as quick and dirty as that will do:

Code: Select all

<?php
$db = JFactory::getDBO();
...
$query = 'SELECT description, version, hits FROM #__phocadownload WHERE id=2';
$db->setQuery($query);
$std = $db->loadObject();
?>
...
<div style="margin-bottom: 1em; overflow: auto; color: #5573BC;">
	<div style="width: 25%; float: left;"><?php echo $std->description; ?></div>
	<div style="width: 18%; float: left;"><?php echo $std->version; ?></div>
	<div style="width: 15%; float: left;"><?php echo $std->hits; ?></div>
	<div style="width: 18%; float: left;">
<?php if($giveStd) { ?>
		<a href="/index.php?option=com_phocadownload&view=category&download=2"><span style="color: #80B284;"><strong>Download</strong></span></a>
<?php } else { ?>
		<span style="color: red;"><strong>Please <a href="/buy-now">buy</a> a license</strong></span>
<?php } ?>
	</div>
</div>
But I thought something more 'elegant' was possible, not relying on table and column names etc.

By the way: have I mentioned already that your product is really great?

Best regards,
Yuri
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48550
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Access to file properties

Post by Jan »

Hi, sorry for misunderstanding, I thought, you mean a form in fronten upload view to add such data to system when uploading file in frontend.

It depends on which view you want to display the information. If e.g. in file view, then you don't need to load specific SQL query as the data (description, version, hits) are there:
https://www.phoca.cz/documents/17-phoca- ... load-theme
Jan
If you find Phoca extensions useful, please support the project
yurkir
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 23 Feb 2017, 10:07

Re: Access to file properties

Post by yurkir »

Thanks! That's exactly what I was looking for.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48550
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Access to file properties

Post by Jan »

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