rejetto forum

Custom Download Link Possible?

Keeper · 6 · 2221

0 Members and 1 Guest are viewing this topic.

Offline Keeper

  • Occasional poster
  • *
    • Posts: 3
  • The Keeper of Keyz
    • View Profile
    • Black Wolf Productions
Love the program.  Made it so much easier to transfer files to / from home when needed.

Have a question I hope can be answered.  I originally found HFS when I was searching for a simple to use server to transfer eReader type ebooks to my iPhone.  In the previous versions of the eReader software it would allow the standard links your software made to download the books into the eReader application.  Now, due to restrictions by Apple, they cannot do this internally in their reader and so have to kick you out to the Safari browser to download the files.  The problem is that Safari does not recognize the PDB file format and fails on the download.  The solution is the make the link that downloads the files be ereader://serveraddress/folder/book.pdb instead of the usual http://serveraddress/folder/book.pdb.  That way Safari will know to kick the download the the eReader software.

My question:  Is it possible to use a template or something that will make the links automatically be ereader:// for files with PDB extensions?  Or if that is not possible make ANY file links be ereader:// instead of http:// ?

I know nothing of templates and was hoping for some assistance with this.  Is this at all possible with HFS?

Thanks in advance for your help!
Is there really such a thing as being too wired???


Offline raffdich

  • Occasional poster
  • *
    • Posts: 10
    • View Profile
hi Keeper,

you can edit your template and add ereader:// like this

<a href="{.if|{.%item-ext%=pdb.}|ereader://.}%item-url%" {.$target.}>%item-name%{.if|{.get|is new.}|&nbsp;-&nbsp;<b class="new">{.!lv_new.}</b>.}</a>

this will replace http:// to ereader:// if the file extension is *.pdb


Offline Keeper

  • Occasional poster
  • *
    • Posts: 3
  • The Keeper of Keyz
    • View Profile
    • Black Wolf Productions
Any specific place I should insert the code?  Sorry I really do not know any HTML programming.  I know how to edit the HTML template from the menu options but do not know where your code should go / replace.

Little more help please?
Is there really such a thing as being too wired???


Offline raffdich

  • Occasional poster
  • *
    • Posts: 10
    • View Profile
the code was not correct  ::)
use this
{.if|{.%item-ext%=pdb.}|ereader://%host%%url%.}

the place where you insert / replace the code is conditional to your template...

for example a part of the code from "thunderchicken of glory" template

[file]
<tr>
<td class="iconCol">
   <a href="%item-url%">
   <div style="background:url('/~img_file') center center no-repeat">{.switch|%item-ext%|,|jpg,jpeg,png,bmp,tif,tiff|
   <div style="background:url('previews_and_thumbnails/thumb-%item-name%.jpg') center center no-repeat"></div>|.}
   </div>
   </a>
</td>

<td class="fileCol{.if not|{.get|can access.}|protected.}">
   <div class="fileInfo">{.if|{.get|can delete.}| <input type='checkbox' name='selection' value="%item-url%"> .}
   <a href="{.if|{.%item-ext%=pdb.}|ereader://%host%%url%.}%item-url%" {.$target.}>%item-name%{.if|{.get|is new.}|&nbsp;-&nbsp;<b class="new">{.!lv_new.}</b>.}</a><br/>
   %comment%
   <div class="info"><b>{.!lv_size.}:</b> %item-size%</div><div class="info"><b>{.!lv_hits.}:</b> %item-dl-count%</div><div class="age"><b>{.!lv_age.}:</b> %item-modified%</div>
   </div>
</td>
<td class="quickCol">{.switch|%item-ext%|,|
jpg,jpeg,png,bmp,tif,tiff|
  {.if|{.filesize|%folder-resource%\previews_and_thumbnails\prev-%item-name%.jpg.}
    |{.$preview-btn.}
    |<div class="quickBtn disabled hide"><img src="/template/tog/images/preview.gif" alt="" align="middle"/></div>
  .}
|mp3,flv|{.$preview-btn.}|<div class="quickBtn disabled hide"></div>.}
   <noscript><div class="quickBtn disabled"></div></noscript>
   <div class="quickBtn1 {.if not|{.get|can access.}|disabled.}"><a href="%item-url%" {.$target.}><img src="/template/tog/images/download.gif" alt="DL" title="{.!lv_downloadTitle.}"/></a></div>
</td>
</tr>

for example a part of the code from "original" template (line 228)
[file=folder=link]
  <tr><td>
  {.if|{.get|can delete.}{.and|{.get|can access.}|{.get|can archive item.}.}| <input type='checkbox' name='selection' value="%item-url%"> .}
  {.if|{.get|is new.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
  {.if not|{.get|can access.}|<img src='/~img_lock'>.}
  <a href="{.if|{.%item-ext%=pdb.}|ereader://%host%%url%.}%item-url%"><img src="%item-icon%"> %item-name%</a>
  {.if| {.?search.} |{:<div class='item-folder'>{.!item folder.} {.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}:} .}
  {.if| %item-comment% | <div class='comment'>%item-comment%</div> .}

[+file]
...
« Last Edit: May 10, 2009, 06:31:46 PM by raffdich »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13515
    • View Profile
my 0.02

this method should work better.
replace (everywhere)
 %item-url%
with
 {.if|{.%item-ext%=pdb.}|ereader{.or|{.substring|://||%item-full-url%.}|%item-url%.}|%item-url%.}


just remember that our suggestions work only with HFS 2.3


Offline Keeper

  • Occasional poster
  • *
    • Posts: 3
  • The Keeper of Keyz
    • View Profile
    • Black Wolf Productions
I added the ToG template and while I was doing that rejetto's suggestion came in.  So I kept the new template and did the find & replace option as suggested so best of both worlds. 

IT WORKS!

Thank you both for your suggestions & help.  I have been trying to figure out how to do this for weeks now.  Should have just come here in the first place.

Thanks again.   :D

Think I'll have to make a donation to this great software.  (Edit: In fact I just did  :) )
« Last Edit: May 10, 2009, 07:42:16 PM by Keeper »
Is there really such a thing as being too wired???