rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: Flynsarmy on November 25, 2006, 06:44:24 AM

Title: Javascript and Img Icons in HFS
Post by: Flynsarmy on November 25, 2006, 06:44:24 AM
I've been trying to use Javascript to call a function from within the [file] tag like so:

Code: [Select]
[file]
addFile("%item-name%", "%item-url%", "%item-size%", "%item-modified%", "%item-dl-count%", "%comment%", "%new%");


inside the addFile function, I have the line
Code: [Select]
document.write('<a href="'+url+'"><img name="newimg"'+fileNum+'" src="/\~img_file" /><br>'+name+'</a><br>');
Basically, this will show the image with a link. The problem is, the page only displays a little white box which i'm assuming is the
default HFS icon. I believe the problem is that if you don't call ~img_file within the [file] tag, HFS will return the default image.
addFile() is not located within the [file] section, its in the pages <head> tag.

Does anyone have any ideas on how to get images working if called in a javascript function? Maybe a new HFS function would
help, something like: ~img_file?<url> which would make HFS retrieve the icon for the file in the URL (a file within the
filesystem). You could call it like
Code: [Select]
<img src=~img_file?%item-url%>
Any help would be appreciated.
Title: Re: Javascript and Img Icons in HFS
Post by: rejetto on November 25, 2006, 01:13:55 PM
pass the icon as parameter as well
Title: Re: Javascript and Img Icons in HFS
Post by: Flynsarmy on November 25, 2006, 03:25:35 PM
Would it be possible to get an example of how I could do that? Earlier today I managed to create the icons
but couldn't figure out how to set a second image to be the same as the icon image. I've attached the work
I did today. It's a really messy way of doing it, and there is no doubt a better way.

[attachment deleted by admin]
Title: Re: Javascript and Img Icons in HFS
Post by: unlogged rejetto on November 25, 2006, 04:17:31 PM
something like
Code: [Select]
[file]
addFile("%item-name%", "%item-url%", "%item-size%", "%item-modified%", "%item-dl-count%", "%comment%", "%new%", "~img_file");

it's the same...

but couldn't figure out how to set a second image to be the same as the icon image.

second image?  ???