rejetto forum

MIME-type filter in [file] section

0 Members and 1 Guest are viewing this topic.

Offline SamePaul

  • Occasional poster
  • *
    • Posts: 72
    • View Profile
Hello there :)

As usual I have crazy proposal that potentially may result in more effective and clean template writing.
As long as I know, today in order to handle differently file types (lets say images diferently than music) I have to write something like this

Code: [Select]
[file.jpg=file.jpeg=file.gif=file.png=file.bmp= ...and other 1000 types of image...]
<tr> <td> handle images one way </td> </tr>

[file.mp3=file.m4a=file.aac=file.flac=file.mpc= ...and other 1000 types of audio...]
<tr> <td> handle audio files another way </td> </tr>

[file.avi=file.mkv=file.mp4=file.flv=file.mpg= ...and other 1000 types of video...]
<tr> <td> handle video files third way </td> </tr>

In my example it looks compact but is actually not.
1.  we indeed have thousands of file types for audio/video/pictures/other documents.
2. consider if type-specific section handles only small part of whole HTML code - file icon - but all other attributes are handled uniformly
Code: [Select]
[file=folder]
<tr><td><a href="%item-url%">

[+file.jpg=+file.gif....]
<img src="/images/picture.png">

[+file.avi=+file.mkv....]
<img src="/images/video.png">

[+file=+folder]
</td><td>... all item attributes</td>

[+file.jpg=+file.gif....]
<button onclick="preview('%item-url%')">Preview</button>

[+file.avi=+file.mkv....]
<button onclick="play_flash('%item-url%')">Play</button>

[+file=+folder]
</tr>

Nice feature, isn't? Now consider every section [file.xxx=..] indeed includes many types?

My proposal is as follows. Support for file section like this [file|mime: filter].
For example [file|mime: images/*] would match every images registered in HFS MIME-types list; [file|mime: image/jpeg] would match only JPEG images etc.
This format is just proposal. There are different variants, like [file(image/*)]. This has advantage that it can be used like this: [+file(images/*)=+file(video/*)]

Hope rejetto finds it useful.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
that's to not write file.jpg=file.gif=file.png=etc, correct?
i understand it's nicer, but we have so many important things in the to-do list that it will never see the light. Sorry


Offline SamePaul

  • Occasional poster
  • *
    • Posts: 72
    • View Profile
OK. There are more important stuff indeed   ::)
Good that you respond. I was starting to worry