SitePoint Sponsor

User Tag List

Page 3 of 3 FirstFirst 123
Results 51 to 64 of 64
  1. #51
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by awasson View Post
    Hey Ian,
    Those are some great solutions you posted for the database structure and managing the pet gallery. Very nice. It's also nice to see I'm not the only one cobbling together ASP/AJAX code on the fly.

    These are pure gold!

    Cheers,
    Andrew
    Cheers for the big-up.
    Ian Anderson
    www.siteguru.co.uk

  2. #52
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hey guys, now when im finally done with the site (every function seems to work correctly ), i can move on to siteguru's idea.

    but before that, i asked in the DB forum about the SQL we have discussed here earlier and this is the reply i got by r937:
    that would be a problem with your asp logic

    using a LEFT OUTER JOIN, the query returns 0, or 1, or many pictures for each animal, depending on how many pictures there are for each animal

    your asp logic has to decide what to do when there is 0, or 1, or many

    but another query is not needed
    Any1 knows what does that means in simpler words ?
    for more information here is the topic :
    http://www.sitepoint.com/forums/showthread.php?t=710160

    thanks

  3. #53
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I think I know what Rudy means. In your ASP code you need to check the recordset for values in fields Filename, Filename2, Filename3 and Filename4. Thus the data is there (but might be empty if no data exists in the database), but unless you specifically check for them you won't show the images.
    Ian Anderson
    www.siteguru.co.uk

  4. #54
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,030
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I've responded to the thread over on the database forum... Once we sort out the SQL over there we can move it back here.

    Edit: Oops didn't see Ian's response.
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  5. #55
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,030
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Ok ulthane now that Rudy (on the DB forum) has given some insight on how to do a one query solution do you think you'll be able to take it from here?
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  6. #56
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    not yet...
    the results are just like i expected
    1 fido 2.jpg
    1 fido 1.jpg

    But now, how do i display both of the images? when using the SQL it always shown only the first one, not the rest of them.

    I'm going to check it again now to be sure.

  7. #57
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,030
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Well the simplest way I can think of is to loop through your recordset array twice.. Once to get the general information about the pet and the second to get all of the images.
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  8. #58
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    yeah, thats what i think aswell, however we'll see how i'll do it already when ill get to the part ill need it

    now im working on the new pet gallery idea, and i have found some very nice script (i think its based on PHP) to be able to put images, names of pets below each image, and i can set how many pics will be in each line / row, so when it gets to the limit i set, a button to go to Page2 appears and then only the images div gets changed to Page2 not all the page.

    The problem is that if i keep this script i dont know how i would do the Onclick event siteguru offered
    Code:
    <img src="photo001.jpg" onclick="morephotos('<%=PetID%>')" />
    Since the displaying is done in this way:

    The page that lists all images and names
    GetPets.ASP
    Code:
    var screenshots={
    baseurl: "db/petPhotos/",
    images: [
    <%
    DB = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/animals.mdb")
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open AnimalDB
    GetPics = "SELECT a.FileID, a.PetName, p.FileName FROM Animals a INNER JOIN Pictures p ON a.FileID=p.UniqueNum WHERE a.AnimalType = 'dog' AND a.AdoptionStatus = 'available' AND p.Main='1' ORDER BY a.FileID"
    table1 = runquery(GetPics)
    if isarray(table1) then
    limit = UBound(table1,2)
    For iCounter = 0 to limit
      %>
      ["<%=table1(0,iCounter)%>" , "<%=table1(2,iCounter)%>" , "<%=table1(1,iCounter)%>"],
      <%
    Next
    end if
    Conn.Close
    Conn = Nothing
    function runquery(query) 
     Set RS = Conn.Execute(query)
     if NOT RS.EOF AND NOT RS.BOF then
      runquery = RS.GetRows
     end if        
    set RS = nothing
    End Function
    %>
    ["placeholder"]
    ],
    desc: []
    }
    And on the main page:
    Dogs.ASP
    Code:
    ' in the <head> tag
    <link href="style.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="ddphpalbum.css" />
    <script src="GetPets.asp?id=screenshots"></script>
    <script type="text/javascript" src="ddphpalbum.js"></script>
    <script type="text/javascript">
    window.onload = function hide() {
      document.getElementById('photos').style.visibility='hidden';
    }
    </script>
    ' in the <body> tag
    <script type="text/javascript">
        new phpimagealbum({
            albumvar: screenshots,
            dimensions: [4, 3],
            sortby: ["date", "desc"],
            autodesc: "%d",
            showsourceorder: false,
            onphotoclick: function (thumbref, thumbindex, thumbfilename) {
                thumbnailviewer.loadimage(thumbref.src, "fit2screen")
            }
        })
    </script>
    any ideas?
    2nd quesiton, why do i get an error ( on the GetPets.asp page code i posted) Object variable not set: 'Conn'

  9. #59
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,030
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure about that PHP based script... I would keep it simple as per Siteguru's suggestions or use jQuery and the lightbox plugin. Google it and you'll see what it is... It's kind of over used but it's also easy to use and very intuitive.

    The reason you have the Conn problem is because you've destroyed it about a third of the way through the script and then you try to use it again. I would set Conn at the very beginning of the page and destroy it at the very end.

    Cheers,
    Andrew
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  10. #60
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    the problem is that i want to have the ability to move between pages easily without changing all of it

    u can look at this example to see what i mean...
    http://sospets.brinkster.net/gallery.html

    hope u wont get bandwidith limit reached msg

    i just noticed there's a OnPhotoClick event inside the script, maybe we could use it someway?
    Code:
    <script type="text/javascript">
        new phpimagealbum({
            albumvar: screenshots,
            dimensions: [4, 3],
            sortby: ["date", "desc"],
            autodesc: "%d",
            showsourceorder: false,
            onphotoclick: function (thumbref, thumbindex, thumbfilename) {
                thumbnailviewer.loadimage(thumbref.src, "fit2screen")        }
        })
    </script>

  11. #61
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,030
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I got the bandwidth limit message.

    I thought what Siteguru was suggesting was that you have your "Pet" page come up with a main image and then if you click the image or some sort of link that indicates "View more pictures", you would be presented with a container showing the images in a slideshow format or something like that.

    For instance you could do something like the "Lightbox" plugin: http://www.lokeshdhakar.com/projects/lightbox2/
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  12. #62
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I thought what Siteguru was suggesting was that you have your "Pet" page come up with a main image
    Thats excactly what the above forms are doing, listing all main pictures of each animal in a page using the script, so this part is finished.

    The question is if i can somehow change this script, so when ill click an image, instead of showing the image in a bigger size, it'll show more photos / info regarding the pet choosen

    i dont really want to delete the script because it enables me to move between images easier by having Page1, Page2, Page3 links etc below the images, allow me to change only the div containing the images, so i dont have to move to a completely different page nor having to scroll down so much to see more pets

    long story short, the current question is, how can i do it so when some1 click on an image using this script i posted above, it'll pop up the window to see more photos/infos regarding the choosen pet.

    ill check the link u gave above now and see what ill come up with, thanks

  13. #63
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,097
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the question is how your DB is set up. I know that there are other posts going on in the database forums as well regarding this topic. You limit yourself by saying
    how can i do it so when some1 click on an image using this script i posted above, it'll pop up the window to see more photos/infos regarding the choosen pet.
    You should ask yourself how can I Achieve this no matter how. There are enough plugins around in which you can load html or inline content as well.

  14. #64
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i wanted to keep it just because it has a function for easy surfing between the images pages, but leave that asside for now...

    i'm trying to do this in a different way as it appears on the new topic i've opened..., if u got any other scripts u can show me that does similar stuff, then go on, i would like to see them


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
  •