rejetto forum
May 26, 2012, 01:52:16 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to download a file in a new page?  (Read 742 times)
0 Members and 2 Guests are viewing this topic.
stonecooper
Occasional poster
*
Offline Offline

China China

Posts: 8


View Profile
« on: August 26, 2011, 09:38:46 PM »

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:
Code:
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'>&nbsp;NEW&nbsp;</span>.}
{.if not|{.get|can access.}|<img src='/~img_lock'>.}
<a href="~files.lst"><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 :
Code:
%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?
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #1 on: August 29, 2011, 03:47:12 PM »

you should link not "~files.lst" but "?mode=section&id=download&url={.encodeuri|%item-url%.}"

then you add a section to the template

Code:
[download]
Please <a href='{.?url.}'>click here</a> to download

i didn't test it! good luck ^^

Follow members gave a thank to your post:

stonecooper

For this post, 1 member gave a thank you!
Logged
raybob
Tireless poster
****
Offline Offline

United States United States

Posts: 206



View Profile WWW
« Reply #2 on: August 29, 2011, 05:18:49 PM »

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%.}" ?
« Last Edit: August 30, 2011, 10:25:21 AM by raybob95 » Logged
stonecooper
Occasional poster
*
Offline Offline

China China

Posts: 8


View Profile
« Reply #3 on: August 30, 2011, 06:35:54 AM »


i didn't test it! good luck ^^

 Wink Thanks, it's works!!
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #4 on: September 01, 2011, 07:50:40 AM »

the "~download" form is deprecated.
You may not find it in HFS 3.
Logged
raybob
Tireless poster
****
Offline Offline

United States United States

Posts: 206



View Profile WWW
« Reply #5 on: September 01, 2011, 09:18:07 AM »

Lol then I may not be able to upgrade to HFS 3 when the time comes because all my pages use that   Cheesy   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?
« Last Edit: September 03, 2011, 07:15:18 PM by raybob95 » Logged
rejetto forum
« Reply #5 on: September 01, 2011, 09:18:07 AM »

Do you like this software? Consider even $2
 Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 17, 2012, 02:13:32 PM
anything