Author Topic: How To Change Default Folder Icon For ALL Folders  (Read 5058 times)

0 Members and 1 Guest are viewing this topic.

Offline Nighted

  • Occasional poster
  • *
  • Posts: 24
  • Meat Popsicle
    • View Profile
How To Change Default Folder Icon For ALL Folders
« 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.



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!
« Last Edit: August 01, 2009, 11:29:35 AM by Nighted »

Offline sequestrum

  • Occasional poster
  • *
  • Posts: 13
    • View Profile
Re: How To Change Default Folder Icon For ALL Folders
« Reply #1 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>

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1842
    • View Profile
Re: How To Change Default Folder Icon For ALL Folders
« Reply #2 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>


 
« Last Edit: August 03, 2009, 04:16:07 PM by SilentPliz »

Offline sequestrum

  • Occasional poster
  • *
  • Posts: 13
    • View Profile
Re: How To Change Default Folder Icon For ALL Folders
« Reply #3 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.

Offline Nighted

  • Occasional poster
  • *
  • Posts: 24
  • Meat Popsicle
    • View Profile
Re: How To Change Default Folder Icon For ALL Folders
« Reply #4 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! :)



Offline etherknight

  • Occasional poster
  • *
  • Posts: 23
    • View Profile
Re: How To Change Default Folder Icon For ALL Folders
« Reply #5 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).

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1842
    • View Profile
Re: How To Change Default Folder Icon For ALL Folders
« Reply #6 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.

Offline etherknight

  • Occasional poster
  • *
  • Posts: 23
    • View Profile
Re: How To Change Default Folder Icon For ALL Folders
« Reply #7 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  ;)

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12888
    • View Profile
Re: How To Change Default Folder Icon For ALL Folders
« Reply #8 on: October 11, 2010, 04:56:13 PM »