rejetto forum
Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: stonecooper on August 27, 2011, 02:38:46 AM
-
Does anyone know how to download a file in a new page? In 2.3 279 default.dpl, when you click the file, the file is donwload directly. How could change the templates when click the file, it will jump to a new page, and this page I will write some warming message and another link to the file, this link is the real link for the file.
I modidied the default.tpl file link to ~files.lst like this:
file=folder=link|private]
<tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
<input type='checkbox' class='selector' name='selection' value='%item-url%' {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
{.if|{.get|is new.}|<span class='flag'> NEW </span>.}
{.if not|{.get|can access.}|<img src='/~img_lock'>.}
<a [color=red]href="~files.lst"[/color]><img src="%item-icon%"> %item-name%</a>
{.if| {.?search.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
{.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}
And then modified the filelist.tpl to :
%files%
[files]
%list%
[file]
%item-url%
The new page will display when you click the file, but the new page contain all the files %item-url% in the current folder, I think this is because the marco %list% expand to all the file list in the current folder.
Any one konw how to implement this feature?
-
you should link not "~files.lst" but "?mode=section&id=download&url={.encodeuri|%item-url%.}"
then you add a section to the template
[download]
Please <a href='{.?url.}'>click here</a> to download
i didn't test it! good luck ^^
-
you should link not "~files.lst" but "?mode=section&id=download&url={.encodeuri|%item-url%.}"
Why use "?mode=section&id=download&url={.encodeuri|%item-url%.}" when you could just use "~download?url={.encodeuri|%item-url%.}" ?
-
i didn't test it! good luck ^^
;) Thanks, it's works!!
-
the "~download" form is deprecated.
You may not find it in HFS 3.
-
Lol then I may not be able to upgrade to HFS 3 when the time comes because all my pages use that :D I actually have any containing url ?mode=section forward to ~deny on my site. I just thought it gave cleaner looking URLs... Why would it become deprecated?