Get a direct link instead of the Phoca controlled link

Phoca Download - download manager
Ballerup-ok
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 06 Jun 2018, 12:58

Get a direct link instead of the Phoca controlled link

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Get a direct link instead of the Phoca controlled link

Post 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
If you find Phoca extensions useful, please support the project
Ballerup-ok
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 06 Jun 2018, 12:58

Re: Get a direct link instead of the Phoca controlled link

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Get a direct link instead of the Phoca controlled link

Post 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
If you find Phoca extensions useful, please support the project
Ballerup-ok
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 06 Jun 2018, 12:58

Re: Get a direct link instead of the Phoca controlled link

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Get a direct link instead of the Phoca controlled link

Post by Jan »

Hi, it is set in File edit in administration - in each file, you can set that the link will be direct.

Jan
If you find Phoca extensions useful, please support the project
Ballerup-ok
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 06 Jun 2018, 12:58

Re: Get a direct link instead of the Phoca controlled link

Post 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>';

										}
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Get a direct link instead of the Phoca controlled link

Post by Jan »

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