Home

OFF-SOFT.net

OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

How to link to another site's files with Phoca Download

Published on| May 29th, 2009 | 1 Comment.
Description:
Joomla! Download as a component in managing the Phoca Donwload, is one of the most popular components. This component has the functionality of external links. This, Download when you click the button, which can be set to go for it.

However, when I manage of site, I want to decrease the stress of server. So we think that we want to move download files to another site(server).
Phoca Donwload, you can easily set up.

This is to hide the link for external links and easy, I would like to describe it.

Setting the external links
Phoca Download settings file, external URL links (External URL Link) files to an external link to the URL "http://" type only.

This screen is just below the external URL links (External URL Link) to
"http://www.example.com/download/sample.zip" is just that type.
Phoca Donwlod show an error when the file name is not input. I thought enough that External URL Link is set, but it is error. Perhaps, I thought it need to known for information of the size etc. But it was OK when I input non-exist filename.
muuu,I don't know....



When configured this way, when trying to download this file,
"http://www.example.com/download/sample.zip" is to download the file.


So, you decided to download from the following screen. Buttons (links) will be partially enclosed by a red border.

Here Mouse over the link
"http://www.example.com/download/sample.zip" or invisible?

A visitor to see a reliable and articles, if possible, HTML is a direct link I want.
(I want a file is downloaded, you can go directly to the picture. So you may be decrease the chance that the visitor sees your homepage. )



The following describes how to not to link directly to an external link.

External links to disappear
Contact external link, not directly linked, to set the link like you have not set a normal Direct Link describes how easily.

The following is a sample test download Phoca Donwload address linked at the time.
1
<a href="/en/download/category/2-samplecategory.html?download=2%3Asamplefile"  rel="nofollow">Sample File</a>
Not a direct link, no address on the external link.

Thus, HTML just seen is the true location of the lost.

Do not be like this, I think.
Approximate, and can make the following changes. However, this is just hiding around the HTML.
The following three changes to the files.

  • %joomla!install%/components/com_phocadownload/models/category.php
    - I read the download.
  • %joomla!install%/components/com_phocadownload/models/file.php
    - I read the download.
  • %joomla!install%/components/com_phocadownload/views/category/tmpl/default.php
    - I set the link to download.

So, immediately, we described the changes easily.

category.php

Origin
186
187
188
189
		$query = " SELECT c.filename, c.directlink, c.access"
				." FROM #__phocadownload AS c"
				. " WHERE " . implode( " AND ", $wheres )
				. " ORDER BY c.ordering";

Modified
186
187
188
189
		$query = " SELECT c.filename, c.directlink, c.access, c.link_external"
				." FROM #__phocadownload AS c"
				. " WHERE " . implode( " AND ", $wheres )
				. " ORDER BY c.ordering";

Origin
227
228
229
230
231
232
233
234
235
236
237
238
239
			$absolutePath	= PhocaDownloadHelper::getSettings('absolute_path', '');
			if ($absolutePath != '') {
				$this->_directlink = 0;
			}
 
			if ($this->_directlink == 1 ) {
				$relFile = JURI::base(true).'/'.PhocaDownloadHelper::getSettings('download_folder', 'phocadownload' ).'/'.$this->_filename;
				$outcome['file'] 		= $relFile;
				$outcome['directlink']	= $this->_directlink;
				return $outcome;
			} else {
				$absFile = str_replace('/', DS, JPath::clean($filePath['orig_abs_ds'] . $this->_filename));
			}

Modified
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
			$absolutePath	= PhocaDownloadHelper::getSettings('absolute_path', '');
			if ($absolutePath != '') {
				$this->_directlink = 0;
			}
 
			//	add 
			if (isset($filename[0]->link_external) && $filename[0]->link_external!=''){
				$outcome['file'] 		= $filename[0]->link_external;
				$outcome['directlink']	= 1;
				return $outcome;
			}
			//	add 
 
			if ($this->_directlink == 1 ) {
				$relFile = JURI::base(true).'/'.PhocaDownloadHelper::getSettings('download_folder', 'phocadownload' ).'/'.$this->_filename;
				$outcome['file'] 		= $relFile;
				$outcome['directlink']	= $this->_directlink;
				return $outcome;
			} else {
				$absFile = str_replace('/', DS, JPath::clean($filePath['orig_abs_ds'] . $this->_filename));
			}

This process is intended to run when you click the download.
I have to remove the name of the file to download. Here, the URL address of the external (External URL Link) If it is set, the same process that is set to direct links.
That is, since this behavior is the same as if from a good set of direct links.

file.php

Origin
140
141
142
143
		$query = " SELECT c.filename, c.directlink, c.access"
				." FROM #__phocadownload AS c"
				. " WHERE " . implode( " AND ", $wheres )
				. " ORDER BY c.ordering";

Modified
140
141
142
143
		$query = " SELECT c.filename, c.directlink, c.access, c.link_external"
				." FROM #__phocadownload AS c"
				. " WHERE " . implode( " AND ", $wheres )
				. " ORDER BY c.ordering";

Origin
183
184
185
186
187
188
189
190
191
192
193
194
195
			$absolutePath	= PhocaDownloadHelper::getSettings('absolute_path', '');
			if ($absolutePath != '') {
				$this->_directlink = 0;
			}
 
			if ($this->_directlink == 1) {
				$relFile = JURI::base(true).'/'.PhocaDownloadHelper::getSettings('download_folder', 'phocadownload' ).'/'.$this->_filename;
				$outcome['file'] 		= $relFile;
				$outcome['directlink']	= $this->_directlink;
				return $outcome;
			} else {
				$absFile = str_replace('/', DS, JPath::clean($filePath['orig_abs_ds'] . $this->_filename));
			}

Modified
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
			$absolutePath	= PhocaDownloadHelper::getSettings('absolute_path', '');
			if ($absolutePath != '') {
				$this->_directlink = 0;
			}
 
			//	add 
			if (isset($filename[0]->link_external) && $filename[0]->link_external!=''){
				$outcome['file'] 		= $filename[0]->link_external;
				$outcome['directlink']	= 1;
				return $outcome;
			}
			//	add 
 
			if ($this->_directlink == 1) {
				$relFile = JURI::base(true).'/'.PhocaDownloadHelper::getSettings('download_folder', 'phocadownload' ).'/'.$this->_filename;
				$outcome['file'] 		= $relFile;
				$outcome['directlink']	= $this->_directlink;
				return $outcome;
			} else {
				$absFile = str_replace('/', DS, JPath::clean($filePath['orig_abs_ds'] . $this->_filename));
			}

category.php process is the same. The only difference between what line number is the same.


default.php

Origin
189
190
191
192
193
194
195
196
197
198
199
200
					// EXTERNAL LINK
					if ($valueDoc->link_external != '') {
 
						$linkDownloadB = '<a href="'.$valueDoc->link_external.'" target="'.$this->paramstmpl['download_external_link'].'" >';
						$linkDownloadE ='</a>';
 
					} else {
 
						$linkDownloadB = '<a href="'. JRoute::_('index.php?option=com_phocadownload&view=category&id='.$this->category[0]->id.':'.$this->category[0]->alias.'&download='.$valueDoc->id.':'.$valueDoc->alias.$this->tmpl['limitstarturl'].'&Itemid='. JRequest::getVar('Itemid', 1, 'get', 'int')).'">';				
						$linkDownloadE ='</a>';
 
					}

Modified
189
190
191
192
193
194
195
196
197
198
199
200
				//	// EXTERNAL LINK
				//	if ($valueDoc->link_external != '') {
				//		
				//		$linkDownloadB = '<a href="'.$valueDoc->link_external.'" target="'.$this->paramstmpl['download_external_link'].'" >';
				//		$linkDownloadE ='</a>';
				//		
				//	} else {
 
						$linkDownloadB = '<a href="'. JRoute::_('index.php?option=com_phocadownload&view=category&id='.$this->category[0]->id.':'.$this->category[0]->alias.'&download='.$valueDoc->id.':'.$valueDoc->alias.$this->tmpl['limitstarturl'].'&Itemid='. JRequest::getVar('Itemid', 1, 'get', 'int')).'">';				
						$linkDownloadE ='</a>';
 
				//	}

Above is intended to display the category list.
Here, the URL address of the external (External URL Link) If it is set, the link address that is set to HTML, and then comment out this process. In other words, the URL address of the external (External URL Link), even if the set is not set to direct the landing.



Setting the example here is one way. This is linked, but not disappear entirely.

In this example, in the end, the URL address of the external (External URL Link) from a set of redirects to the destination, in part, upon technology, it is redirected, I see. In not perfect, I think about a simple blindfold can.

I wish your help by this article.


Comments

1 Comment. “How to link to another site’s files with Phoca Download”


  1. Andre
    April 27th, 2012 @ 03:44:43

    Guy, you saved my life! Thank you so much. I’ve been trying to use external links in PhocaDownload for weeks without success.

Leave a Reply







  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ