rejetto forum

Recently Uploaded Files List?

Age · 5 · 6096

0 Members and 1 Guest are viewing this topic.

Offline Age

  • Occasional poster
  • *
    • Posts: 17
    • View Profile
    • Integers of K
Hello,

Long time fan of HFS here, and I try my best to learn everything I can from the wiki and the forum before posting, but I'm having trouble figuring this out.

Is there anyway to display a list of the top ten latest files that were uploaded? (I'm using Beta 271)

Any advice would be well received.

Thanks,


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
sorry for the late reply.
it is possible.
anyway HFS by itself doesn't hold a list of uploaded files, you must create this list yourself.
use the [upload completed] event http://www.rejetto.com/wiki/index.php/HFS:_Event_scripts
store the name of the item in a variable or a file.
a way is to treat the list as a text, and use a line for every item.
you put the new one on top of others.
Code: [Select]
[upload completed]
{.set|#uploads|%item-name%
|mode=prepend.}

but you should also discard lines over 10th.
use {.for.} to run 10 times {.pos.} then {.cut.} the rest of the string.
This is left as homework ;)

after you got your list in memory, you use it as you like.
a plus would be to {.save.} it every time it is changed, and {.load.} it at event [start]
so it won't clear at every restart of HFS.
« Last Edit: November 08, 2010, 10:45:46 PM by rejetto »


Offline Age

  • Occasional poster
  • *
    • Posts: 17
    • View Profile
    • Integers of K
Alright, I'm committed to this.
So just for testing purposes, I'll use a variable because that seems like it's easier.

In my macros I put:

Code: [Select]
[upload completed]
{.set|variablerecentuploads|%item-name%
|mode=prepend.}

This should now start logging the names of uploads into a sort of list with "variablerecentuploads" for a name, and each new item is represented by $1, $2, $3, etc. as I can sort of tell from the wiki?(http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands#Variables_and_functions)

Now, assuming that's correct, in order for me to display this list, I am a little confused. Should I put something like this somewhere in my template?

Code: [Select]
{{.^variablerecentuploads|$1.}}to display the first "spot" on the list?

Then follow with:

Code: [Select]
{{.^variablerecentuploads|$2.}}
{{.^variablerecentuploads|$3.}}
{{.^variablerecentuploads|$4.}}
etc... ?

Is there something similar you could direct me to so that I could read up on this?

Thanks for your direction.

<3


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
sorry for the late reply.
nope: your variable is not an indexed table at the moment, is just a text with several lines.
you should go in the direction i told you in my previous message, but i understand it requires programming skills, most people don't have.
in next release (273) i'm introducing some changes that will ease this task a bit. A script like this will be then possible


firstly i copy the list, because we'll destroy it in the process
{.set|#x|var=#uploads.}

{.for|i|1|10|{:
  at number {.^i.} we got {.chop|#x|{.chr|13.}.}
:}


Offline r][m

  • Tireless poster
  • ****
    • Posts: 347
    • View Profile
The attached were posted here some time ago (don't remember by who).
New-files works pretty well.
The filelist.tpl is interesting, but doesn't work very well.
Maybe these will give some ideas to work from.