Results 1 to 4 of 4

Thread: Help Needed.

  1. #1
    Join Date
    Jan 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help Needed.

    Is there a way to make a dynamic link menu that feeds itself with the content of a windows folder.

    So when a file is added to the folder it automaticly appears in the link menu.

    Who can answer/help me?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not in Javascript. Do you have any server-side languages?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No, unfortunately not, its for a local intranet, running on a normal file server.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    'Fraid not, then. It may be possible with some advanced AJAX and a little server manipulation, but I wouldn't want to... oh wait.
    Code:
    <iframe style="width:0;height:0;display:none;" id="hiddenframe">Your browser does not support iframes, so the dynamic link menu will not be available.</iframe>
    <script type="text/javascript">
    window.onload = (function() {
    
      var menuElement = document.getElementById("menu"); // Element to populate
      var dir = "/downloads/"; // Directory to use.  Must not have an index: it needs to send an "index of" page
      var junkLinksTop = 0; // "Junk" links to cut off the top of the menu.
      var junkLinksBottom = 0; // Same, for the bottom.
    
      document.frames['hiddenframe'].src = dir;
      menuElement.innerHTML = "";
      var if = document.frames["hiddenframe"].document,
        a = if.getElementsByTagName("a"),
        i;
      for(i=junkLinksTop;i<a.length-junkLinksBottom;i++) {
        menuElement.innerHTML += '<a href="' + a[i].href + ">' + a[i].innerHTML + '</a>';
      }
    });
    </script>
    This is horribly hacky, and untested, and I'm sure you'll need to tweak it, and it all hinges on your server producing "index of" pages for directories without indices.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •