Page 1 of 1
Get a direct link instead of the Phoca controlled link
Posted: 06 Jun 2018, 14:39
by Ballerup-ok
Hi
I can see that you can set different parameters via the download button plugin, but i would like to make a direct link to the file in some cases.
Is it possible? I do understand that it sets out the access control but still it would be a nice parameter in the plugin.
KR
Michael
Re: Get a direct link instead of the Phoca controlled link
Posted: 06 Jun 2018, 16:42
by Jan
Hi, no for now there is no such option for the plugin, so this needs to be customized directly in the code
Jan
https://www.phoca.cz/documents/51-phoca ... oad-plugin
Re: Get a direct link instead of the Phoca controlled link
Posted: 07 Jun 2018, 12:52
by Ballerup-ok
Well ok. I am a bit new to joomla but do code php. Can you give a hint to which file to change and maybe the function call to retrieve the file location from the id.
Thanks
Kind regards
Michael
Re: Get a direct link instead of the Phoca controlled link
Posted: 08 Jun 2018, 16:44
by Jan
There is only one file in the plugin:
plugins\content\phocadownload\phocadownload.php, see $link variable
You can try to set "direct link" in file edit in administration of Phoca Download, then the link goes direct to the file, even with plugin.
Jan
Re: Get a direct link instead of the Phoca controlled link
Posted: 11 Jun 2018, 09:08
by Ballerup-ok
Hi, thanks, I cant find this Direct link setting, in either the Global Configuration -> Phoca Download, or in the Component->Phoca Download settings/control panel - I have seen som other users refering to this but didnt find it.
I did read the plugin php code and did see the $link variable, i do understand it as the link to the download function and not the direct link, but I havent yet experimentet with it - so it could be correct:-)
/Michael
Re: Get a direct link instead of the Phoca controlled link
Posted: 11 Jun 2018, 12:18
by Jan
Hi, it is set in File edit in administration - in each file, you can set that the link will be direct.
Jan
Re: Get a direct link instead of the Phoca controlled link
Posted: 11 Jun 2018, 13:41
by Ballerup-ok
Well I did mean to get the direct URL of the file and the Direct link option only opens the file instead of download it.
I have made some code in the plugins\content\phocadownload\phocadownload.php. You can just remove the <p> tags in the code to get only the URL, should maybe have been coded regardless of the Mime setting:-)
The $item->filename includes the sub path to the file so its only the base url of the phoca download folder you need to hard code.
Code: Select all
if ($iMime == 1) {
//MMO*
if ($view == 'x') {
$output .='<p> http://www.***insert the hardcoded url to the phoca download folder here***/'.$item->filename.'</p>';
}
else {
//MMO end
$output .= '<div class="pd-filename phocadownloadfile phoca-dl-file-box-mod">'. $imageFileName['filenamethumb']. '<div class="pd-document'.(int)$iSize.'" '. $imageFileName['filenamestyle'].'><a href="'. JRoute::_($link).'" '. $targetOutput.'>'. $textOutput.'</a></div></div>';
//MMO*
}
//MMO end
} else {
$output .= '<p>test2:'.$link.'</p>'.'<div class="phocadownloadfile'.(int)$iSize.'"><a href="'. JRoute::_($link).'" '.$targetOutput.'>'. $textOutput.'</a></div>';
}
Re: Get a direct link instead of the Phoca controlled link
Posted: 11 Jun 2018, 21:37
by Jan
Ok