Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: [DHTML] getpics.asp

  1. #1
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default [DHTML] getpics.asp

    1) CODE TITLE: getpics.asp

    2) AUTHOR NAME/NOTES: jscheuer1, freely adapted from:

    http://www.asp101.com/samples/dir_list.asp

    3) DESCRIPTION: An ASP/VB/JSCRIPT hybrid that is a drop in replacement for getpics.php for servers that have asp, but not php, available. For use with PHP Album script. Use just like getpics.php, replacing this line in PHP Album script:

    HTML Code:
    <script src="http://www.mysite.com/gallery/getpics.php" type="text/javascript"></script>
    with this:

    HTML Code:
    <script src="http://www.mysite.com/gallery/getpics.asp" type="text/javascript"></script>
    4) URL TO CODE:

    or, ATTACHED BELOW (see #3 in guidelines below):

    Simply save the below as 'getpics.asp' and upload it to your image directory just as instructed to for getpics.php.
    Do not edit the file! Comments are developers notes only, not instructions for editing!

    Code:
    <%
    ' The Runtime code:
    ' Create some asp variables for
    Dim strPath   'Path of directory
    Dim objFSO    'FileSystemObject variable
    Dim objFolder 'Folder variable
    Dim objItem   'Variable used to loop through the contents of the folder
    
    ' You could just as easily read this from some sort of input
    ' NOTE: As currently implemented, this needs to end with the /
    strPath = "./"
    
    ' Create our FSO
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    
    ' Get a handle on our folder
    Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
    
    'Create some javascript variables
    %>
    var counter=0
    var galleryarray=new Array()
    <%
    
    'Selecting only images
    For Each objItem In objFolder.Files
    If Right(objItem.Type, 5)="Image" Then
    'Add each one and their date to the array using javascript
    %>
    galleryarray[counter]=["<%= objItem.Name %>", "<%= objItem.DateCreated %>"]
    counter++
    <%
    End If
    Next 'objItem
    
    ' All done!  Kill off our asp object variables.
    Set objItem = Nothing
    Set objFolder = Nothing
    Set objFSO = Nothing
    %>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Default

    I didn't know you knew ASP.

    I'll write a JSP one when my host gets its ass in gear and sorts out its servers...
    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
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I didn't but, they are all pretty straightforward file accessing commands used in a variety of these 'directory listing' script/pages that abound on the web as beginner examples. I just got rid of all of the HTML 'window dressing' and some unnecessary code, added the client side javascript and a little more server side VBscript to make it do the deed.

    But, I am getting excited about asp, not because it is so good, but because it is available on a site I master that needs a way to do template pages and php is not available.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Default

    What other languages are available for writing ASP pages?
    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!

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    What other languages are available for writing ASP pages?
    JScript, to name a relatively obvious one. Perl too, apparently, given the right support. I don't know about any others, but ASP isn't tied to any particular language, so it may only be a matter of developing an interface for a given language (though I'm not going to pretend that that would be trivial).

    For ASP.NET, any .NET-compatible language can be used: Visual Basic .NET, JScript .NET, C#, and Managed C++.

    Mike

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

    Default

    so it may only be a matter of developing an interface for a given language (though I'm not going to pretend that that would be trivial).
    Yeah... "only?"

    I'm aware of the ASP.NET ones, I use C# in ASP.NET occasionally.
    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!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I think the language just has to be available on the server and either declared for the page at the very top:

    Code:
    <%@ LANGUAGE=VBScript %>
    or used in a script tag with the runat=server attribute:

    Code:
    <SCRIPT LANGUAGE=JAVASCRIPT RUNAT=SERVER>
    var bob='bing'
    for (var i_tem = 0; i_tem < 3; i_tem++)
    response.write("I am server-side JavaScript using the SCRIPT tag " + bob + "<P>");
    </SCRIPT>
    These are just from examples I have run across. The default language generally is VBscript. The thing I am coming to terms with now is determining how much if any communication can take place among the various languages on a page. It is relatively easy to communicate from server side to client side however, just as I did in the getpics.asp code. Another biggie is that it appears that although, say you are using server side Jscript. Things like the date object are available but not, apparently, the window and probably nothing like getElementById either, making things rather limited but, as compensation, there are includes, dbase and virtually bullet proof query string info hand offs.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Default

    Things like the date object are available but not, apparently, the window and probably nothing like getElementById either, making things rather limited but, as compensation, there are includes, dbase and virtually bullet proof query string info hand offs.
    Elements and windows are client-side objects. Code running on the server has no access to them -- in fact, it doesn't even know they exist. No DOM-like abstraction of HTML is available, although parse trees are possible.
    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!

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Twey
    No DOM-like abstraction of HTML is available, although parse trees are possible.
    Parse trees? Does this give any access to the parsed document - read and/or write? If not, what does it do? In either case how does it work?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Default

    Quote Originally Posted by jscheuer1
    Does this give any access to the parsed document - read and/or write?
    Yes, in theory. I'm talking only about what's possible, though, not necessarily what's been implemented.
    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
  •