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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: Sitemap

  1. #1
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sitemap

    how would i make a site map in asp?
    i have a pages folder, so should i just list all files in the directory?
    is there a way i can only list certain files, like files with the extension .asp
    or .html because i dont want to list my DB files and other admin pages or anything like that.

    thanks in advance
    -baleric

  • #2
    New Coder
    Join Date
    Apr 2004
    Location
    Columbus, Ohio
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That would be kinda cool...

    1. Us the FS to read everything on the server *.asp
    2. Us the OpenText to read the title, keywords, and description
    3. Have an admin page to update the sitemap.asp (you wouldn't want to do this each time the page loads, if you have a big site)
    4. Place each file in a database
    5. Everytime the sitemap.asp page is called create a tree with Title, url, and description
    6. create a search for title, keywords, and description

    It would take a little work, but that sounds like my next project.

    Good idea
    Hate something?
    Tell us about it
    Go Complain

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    This may be off-topic but your .mdb file should not be accessible in the browser. Otherwise, if someone was able to guess the filename of your db, he/she can download it. You should put the db file outside of your web root folder, the most recommended location is just above your web root folder.
    Code:
    db
      |__data.mdb
    wwwroot
      |__*.asp
    Then in the connection string in asp, you specify the path like this:
    Code:
    Server.MapPath("../db/data.mdb")
    Glenn
    ____________________________________

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

  • #4
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    gocomplain, im gunna give it a go, but if you end up getting it working can u paste the code so its available please,

    glenngv, thanks for the advice, ill start to place the DB outside the pages folder

    thanks guys.

    -baleric

  • #5
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
                <%
    dim fs,fo,x
    set fs=Server.CreateObject("Scripting.FileSystemObject")
    set fo=fs.GetFolder("d:/newsite/pages/")
    
    for each x in fo.files
      'Print the name of all files in the test folder
    Response.write("<a href='" & x.Name & "' target='_new'>" & x.Name & "</a>" & "<br />" )
    
    
    next
    
    set fo=nothing
    set fs=nothing
    %>
    here is the code i managed to find, now how do i make it list only *.asp files?

  • #6
    New Coder
    Join Date
    Jul 2002
    Location
    UK
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Check that x.Name ends with .asp - try right().

  • #7
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    does anyone know how to do this?
    Last edited by Baleric; 03-02-2006 at 08:14 AM.

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Glenn
    ____________________________________

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

  • #9
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i still dont understand, right() makes it read the code from right to left,
    but how does this help me? im trying to list all .asp files

  • #10
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its alright i got it...

  • #11
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Heres the code if anyone is interested
    Code:
    <%
    Dim strPath   
    Dim objFSO    
    Dim objFolder
    Dim objItem        
    Dim strQuery
    
    strPath = "/newsite/pages/" 'DIRECTORY'
    
    strQuery = ".asp" 'FILETYPE'
    
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
    For Each file In objFolder.Files
     fileSize = cint(file.size / 1000) 'convert into kilobytes and drop the decimal
      If InStr(1, file.Name, strQuery, vbTextCompare) <> 0 Then
            %>
    
            <img src="../images/dotsupsmall2.gif" width=20 height=20>
    			<a href="<%= strPath & file.Name %>"><%= file.Name %></a> <%= filesize %>Kb  <br>
    
             
            <%
        End If
    Next 'objItem
    
    Set objItem = Nothing
    Set objFolder = Nothing
    Set objFSO = Nothing
    %>

  • #12
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Your solution will still show the files even if .asp is in between the filename.
    Here's the solution using the Right function.
    Code:
    If LCase(Right(file.Name, 4)) = strQuery Then
    Glenn
    ____________________________________

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

  • #13
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i just tryed it then, it doesnt list files that have asp in the filename i created a file called asp.html and it didnt show it :P

  • #14
    Registered User
    Join Date
    Jan 2006
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    His solution isn't meant to show all files with asp in the name. It shows only .asp files or whatever file extension you're looking for.

  • #15
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    im lost...


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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