rejetto forum
May 25, 2012, 09:19:45 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 Change Default Folder Icon For ALL Folders  (Read 2320 times)
0 Members and 2 Guests are viewing this topic.
Nighted
Regular poster
**
Offline Offline

Canada Canada

Posts: 24


Meat Popsicle


View Profile
« on: August 01, 2009, 06: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, 06:29:35 AM by Nighted » Logged
sequestrum
Occasional poster
*
Offline Offline

Posts: 13


View Profile
« Reply #1 on: August 02, 2009, 03: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:
<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>
Logged
Mars
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1481



View Profile WWW
« Reply #2 on: August 03, 2009, 04:39:01 AM »

Quote
<img src="/icons/{.switch|%item-name%|;|upload|uploadicon.gif|icons|iconsicon.gif|folder.gif.}" border="0">

no javascript is needed Cheesy

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, 11:16:07 AM by SilentPliz » Logged
sequestrum
Occasional poster
*
Offline Offline

Posts: 13


View Profile
« Reply #3 on: August 03, 2009, 04: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.
Logged
Nighted
Regular poster
**
Offline Offline

Canada Canada

Posts: 24


Meat Popsicle


View Profile
« Reply #4 on: August 03, 2009, 11:28:35 AM »

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! Smiley


Logged
etherknight
Regular poster
**
Offline Offline

United States United States

Posts: 23


View Profile Email
« Reply #5 on: October 11, 2010, 12: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).
Logged
rejetto forum
« Reply #5 on: October 11, 2010, 12:51:27 AM »

Do you like this software? Consider even $2
 Logged
Mars
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1481



View Profile WWW
« Reply #6 on: October 11, 2010, 06: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.
Logged
etherknight
Regular poster
**
Offline Offline

United States United States

Posts: 23


View Profile Email
« Reply #7 on: October 11, 2010, 10:34:03 AM »

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  Wink
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11830


View Profile
« Reply #8 on: October 11, 2010, 11:56:13 AM »

try to access http://localhost:PORT/icons/folder.gif
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 24, 2012, 10:51:41 AM