Print Page | Close Window

Simple asp gallery

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=4341
Printed Date: 29 March 2026 at 4:59pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Simple asp gallery
Posted By: oneminuteguy
Subject: Simple asp gallery
Date Posted: 18 July 2003 at 7:16pm

I'm doin (tryin to anyway) a simple gallery (asp/access) for a smaller website. I'd like it to be thumb pages linking to the full size images with an added search function and a paging function. (1,2,3,4>>)

The piece of code below can show u what I mean, it just needs the paging function.
My problem is that I'm not good enuff at asp to incorporate a paging function. So I was wondering if anyone's seen a script like that somewhere, or if maybe someone had a script they wouldn't mind sharing..?

TIA

Regards,
OMG

<% OPTION EXPLICIT %>
<!-- #include file="connect.asp" -->
<html><head><title>Photoalbum</title>
</head><body>

<%
dim strAction
strAction=request("action")

Main

select case strAction
  case "search"
    Search request("searchstr"), 0
  case "category"
    Search request("searchstr"), 1
  case "show"
    ShowImage request("image")
end select

' -------------------------------------
' Functions
' -------------------------------------

sub Main
  %>
  <h1>Photoalbum</h1>
  <p>Search: <form
  action="photoalbum.asp?action=search" method="post">
  <input type="text" name="searchstr">
  <input type="submit"
  value="Søg"></form></p>
  <p>Or choose from category:<br>
  <%
  dim strSQL, objRS, arrCategories, i
  strSQL = "SELECT DISTINCT category FROM PhotoAlbum " & _
          "ORDER BY category"
  strSQL = "SELECT category, count(category) as numcat FROM PhotoAlbum " & _
           "GROUP BY category"

  set objRS = server.createobject("ADODB.Recordset")
  objRS.open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText
  if not objRS.EOF then
    arrCategories = objRS.GetRows
  end if
  objRS.close
  set objRS = nothing
  if isArray(arrCategories) then
    for i = 0 to ubound(arrCategories,2)
      response.write _
        " <a href=""photoalbum.asp?action=category&searchstr=" & _
        server.urlencode(arrCategories(0,i)) & """>" & _
        arrCategories(0,i) & "(" & arrCategories(1,i) & ")" & "</a> "
    next
  end if
  %>
  <hr></p><%
end sub


sub Search (strS, intType)
  dim strSQL, objRS
  if intType = 0 then
    strSQL = "SELECT title, imagename FROM PhotoAlbum " & _
             "WHERE title + description + words LIKE '%" & strS & "%'"
  end if
  if intType = 1 then
    strSQL = "SELECT title, imagename FROM PhotoAlbum " & _
             "WHERE category = '" & strS & "'"
  end if
  set objRS = server.createobject("ADODB.Recordset")
  with objRS
    .open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText
    while not .EOF
      response.write _
        "<p><a href=""photoalbum.asp?action=show&image=" & _
        server.urlencode(.Fields("imagename")) & """>" & _
        "<img src=""/thumbs/" & .Fields("imagename") & """ border=0>" & _
        "</a><br clear=all>" & _
        .Fields("title") & "</p>"
      .movenext
    wend
    .close
  end with
  set objRS = Nothing
end sub


sub ShowImage (strImageName)
  dim strSQL, objRS
  strSQL = "SELECT title, description FROM PhotoAlbum " & _
           "WHERE imagename = '" & strImageName & "'"
  set objRS = server.createobject("ADODB.Recordset")
  with objRS
    .open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText
    if not .EOF then
      response.write _
        "<h1>" & .Fields("title") & "</h1>" & _
        "<img src=""/image/" & strImageName & """>" & _
        "<p>" & .Fields("description") & "</p>"
    else
      response.write _
        "<p>No results: " & strImageName & "</p>"
    end if
    .close
  end with
  set objRS = Nothing
end sub

%>

</body></html>




Replies:
Posted By: Bliss
Date Posted: 22 July 2003 at 3:00pm
Look at the paging mod for WWF to get a hint


Posted By: Flamewave
Date Posted: 23 July 2003 at 11:19am

Are you looking for something like this? (only an image gallery instead of a download gallery) if so, give me an email ( mailto:wflamewave4@juno.com - flamewave4@juno.com ) and I can give you the source code to help you out. I did that for a client awhile back and had to develop it myself, but I don't mind giving out the source code.

Link: http://www.flameservers.com/tfc-customize/TFC_Custumize.asp?Type=Weapon - http://www.flameservers.com/tfc-customize/TFC_Custumize.asp?Type=Weapon



-------------
- Flamewave

They say the grass is greener on the other side, but if you really think about it, the grass is greener on both sides.


Posted By: oneminuteguy
Date Posted: 23 July 2003 at 5:04pm
hey flamewave

that would be great!!! I've sent you a mail.

TIA!!

Regards,
OMG


Posted By: Flamewave
Date Posted: 23 July 2003 at 9:50pm

Hmm, I didnt get your email, but here is the link to a demo and the code:

http://www.flameservers.com/asp_apps/gallery/ - http://www.flameservers.com/asp_apps/gallery/



-------------
- Flamewave

They say the grass is greener on the other side, but if you really think about it, the grass is greener on both sides.


Posted By: oneminuteguy
Date Posted: 24 July 2003 at 5:08am
thx! looks to be just what I need.

Btw I accidently pasted the mailto: tag into ur mail adress. thats why u didnt' get it



Posted By: oneminuteguy
Date Posted: 28 July 2003 at 9:55am
In case anyone's interested I found an easy to use app. on http://www.developersdex.com/gurus/code/251.asp - http://www.developersdex.com/gurus/code/251.asp

Works!


Posted By: Badboy
Date Posted: 01 August 2003 at 7:02am

Can I have a forum that is ASP. But other pages on the server are HTML? Or does everything have to be ASP?



Posted By: oneminuteguy
Date Posted: 01 August 2003 at 9:43am

yes there's no problem in mixing html and asp. Just make sure your web host supports asp, as it is a server side technology.

more info on asp here: http://www.webwiz.net/asp/tutorials/what_is_asp.asp - http://www.webwiz.net/asp/tutorials/what_is_asp.asp  

regards,
omg




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net