Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using a listall function in a list menu

    Hi there

    ive go the following code called list.asp which can display all the files in a certain directory

    <%


    Set Objekt=Server.CreateObject("Scripting.FileSystemObject")
    Set Folder=Objekt.GetFolder(Server.MapPath("pressreleases/"))
    FOR EACH sak in Folder.Files
    if sak.Name="list.asp" then
    'ReadFileLineByLine(Server.MapPath("pressreleases/"))

    end if
    %>

    <%=sak.Name%><br>


    <%
    NEXT
    %>

    I want to be able to somehow insert this into a listmenu, so a user can select from the drop down menu, the appropriate file to link to the title they have entered in an add record. Im having problems though, anyone got any ideas?
    Thanks

    Mat
    Last edited by Matc; 07-07-2004 at 11:45 AM.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Is this what you needed?
    Code:
    <%
    dim optionTag, Objekt, Folder
    Set Objekt=Server.CreateObject("Scripting.FileSystemObject")
    Set Folder=Objekt.GetFolder(Server.MapPath("pressreleases/"))
    For Each sak in Folder.Files
      if LCase(sak.Name)<>"list.asp" then
         optionTag = optionTag & "<option>" & sak.Name & "</option>" & vbCrLf
      end if
    Next
    %>
    <select name="files">
    <%=optionTag%>
    </select>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thats the one, I had just managed to work it so the 1st one in the folder would show up in the list but no others. I was having problems repeating it to show what else was in the folder. That code worked perfectly to sort it.

    Thanks very much mate

    Mat


  •  

    Posting Permissions

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