rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: Nighted on August 01, 2009, 11:20:09 AM

Title: How To Change Default Folder Icon For ALL Folders
Post by: Nighted on August 01, 2009, 11:20:09 AM
Hi

Does anyone know how to change the default folder icon? I don't want to use the system folder icon. I'd like to change it to a custom icon or preferably PNG.

(http://img197.imageshack.us/img197/6972/defolder.png)

I know you can change each folder individually, but I want to change the default that applies to all other folders.

I know that HFS outputs ~img_folder into the HTML it generates, but I haven't figured out how to change it in the newest build.

In the old script it was as easy as:

<td><a href="%item-url%"> %new% <img align="top" src="/Folder.ico" border="0" alt="">&nbsp;&nbsp;<b>%item-name%</b></a></td>

Thanks for any info!
Title: Re: How To Change Default Folder Icon For ALL Folders
Post by: sequestrum on August 02, 2009, 08:33:12 PM
I'm currently working on modifying the HFS default template as well and found this code snippet made by kwondra34, later modified by Giant Eagle: http://www.rejetto.com/forum/index.php?topic=4739.msg1025776#msg1025776
Perhaps there's an easier way somehow, but this was the only thing that I actually got working, since I also wanted different icons for my /upload/ and /icons/.

I modified mine like this:
Code: [Select]
<script type="text/javascript">var img; switch("%item-name%") {
case "upload": img="uploadicon.gif";break
case "icons": img="iconsicon.gif";break
default: img="folder.gif";}
document.write("<img src=\"/icons/"+img+"\" alt=\"\" border=\"0\" alt=\"\" />");
</script>
<noscript>
document.write("<img src=\"/icons/folder.gif\" alt=\"\" border=\"0\" alt=\"\" />");
</noscript>
Title: Re: How To Change Default Folder Icon For ALL Folders
Post by: Mars on August 03, 2009, 09:39:01 AM
Quote
<img src="/icons/{.switch|%item-name%|;|upload|uploadicon.gif|icons|iconsicon.gif|folder.gif.}" border="0">

no javascript is needed :D

I suggest you to use the next template code:
in your ICONS folder you can put icons files named

file extension : mp3.gif, exe.gif, ... ; if the file exist for a specific extension then it replace the default icon %item-icon%
folder name   : uploadicon.gif, iconsicon.gif, ... ; if the file exist for a specific name then it replace the default icon  /icons/folder.gif


you have not to update the future template but just to put the correct GIF in the folder /icons/

Quote
[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="%item-url%">
[+file]
  <img src="{.if|{.filesize|/icons/%item-ext%.gif.}| /icons/%item-ext%.gif | %item-icon% .}" border="0">

[+folder]  
  <img src="{.if|{.filesize|/icons/%item-name%icon.gif.}| /icons/%item-name%icon.gif | /icons/folder.gif .}" border="0">

[+link]
  <img src="%item-icon%">

[+file=+folder=+link]
  %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]
<td align='right'>%item-size%<td align='right'>%item-modified%<td align='right'>%item-dl-count%

[+folder]
<td align='center'><i>folder</i><td align='right'>%item-modified%<td align='right'>%item-dl-count%

[+link]
<td colspan='3' align='center'><i>link</i>


 
Title: Re: How To Change Default Folder Icon For ALL Folders
Post by: sequestrum on August 03, 2009, 09:44:01 AM
Thanks, that's awfully kind of you. I haven't managed to learn to use the full potential of macros well enough yet, so tips like these are always welcome.
Title: Re: How To Change Default Folder Icon For ALL Folders
Post by: Nighted on August 03, 2009, 04:28:35 PM
I suggest you to use the next template code:
in your ICONS folder you can put icons files named

file extension : mp3.gif, exe.gif, ... ; if the file exist for a specific extension then it replace the default icon %item-icon%
folder name   : uploadicon.gif, iconsicon.gif, ... ; if the file exist for a specific name then it replace the default icon  /icons/folder.gif

Works beautifully! Thanks for the info, you've saved me a LOT of time! :)

(http://img233.imageshack.us/img233/2552/hfs.png)
Title: Re: How To Change Default Folder Icon For ALL Folders
Post by: etherknight on October 11, 2010, 05:51:27 AM
Greetings,

I am attempting to use this method but having some issues with folder icons. I know I at least going in the right direction since I can get the file icons to come in by naming an icon with the extension (i.e. pdf.gif). But I just cannot seem to get the folder icon replacements thing down. I am wondering if it might be related to a version difference. Looks like this thread wrapped up over a year ago...so maybe things have changed in the template methodology since then. I am currently using Build #267 (2.3 beta).

I am also using the TCoG template; not sure if that comes into play here (could not get it to work with default template either).
Title: Re: How To Change Default Folder Icon For ALL Folders
Post by: Mars on October 11, 2010, 11:45:47 AM
@etherknight

Quote
[+folder] 
  <img src="{.if|{.filesize|/icons/%item-name%icon.gif.}| /icons/%item-name%icon.gif | /icons/folder.gif .}" border="0">
[+folder] 

You can put a different icon in every folder and modify only the link url as in the example of my previous post

  <img src="{.if|{.filesize|/icons/%item-name%icon.gif.}| folder.gif | /icons/folder.gif .}" border="0">

PS: in the vfs, you can add a virtual file folder.gif for each virtual folder.
Title: Re: How To Change Default Folder Icon For ALL Folders
Post by: etherknight on October 11, 2010, 03:34:03 PM
So the custom icon(s) (named <whatever>icon.gif) would go inside the various folders and not in the global /images/icons folder?

Also, would the link URL modification be a global change? Or would I need to edited for every folder? Sorry for the softball questions; only been using HFS for a bout 2 weeks and still getting my sea legs. It's a great programs...but somewhat mysterious. Not unlike Rejetto himself  ;)
Title: Re: How To Change Default Folder Icon For ALL Folders
Post by: rejetto on October 11, 2010, 04:56:13 PM
try to access http://localhost:PORT/icons/folder.gif