help with if statement. searching for jpg or gif

Discussion in 'ASP General' started by Zen Masta, Apr 13, 2006.

  1. Zen Masta

    Zen Masta Guest

    Original code:
    <% img_name=rs("ISBN") & ".jpg" if CheckPath(img_name)=true then%>
    <IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.jpg" width="50" height="70"
    border=0>
    <% else %>
    <img src="../images/70pixelsTall/noimage70.jpg" width="50" height="70"
    border=0>
    <%end if%>

    I want to change this so that it also looks for gifs also. How can I add the
    following code or change the original code so it checks/displays gifs if jpg
    isn't available.

    <% img_name=rs("ISBN") & ".gif" if CheckPath(img_name)=true then%>
    <IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.gif" width="50" height="70"
    border=0>
    Zen Masta, Apr 13, 2006
    #1
    1. Advertising

  2. Zen Masta

    Mike Brind Guest

    Zen Masta wrote:
    > Original code:
    > <% img_name=rs("ISBN") & ".jpg" if CheckPath(img_name)=true then%>
    > <IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.jpg" width="50" height="70"
    > border=0>
    > <% else %>
    > <img src="../images/70pixelsTall/noimage70.jpg" width="50" height="70"
    > border=0>
    > <%end if%>
    >
    > I want to change this so that it also looks for gifs also. How can I add the
    > following code or change the original code so it checks/displays gifs if jpg
    > isn't available.
    >
    > <% img_name=rs("ISBN") & ".gif" if CheckPath(img_name)=true then%>
    > <IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.gif" width="50" height="70"
    > border=0>



    <%
    img_name=rs("ISBN")
    if CheckPath(img_name & ".jpg")=true then
    %>
    <IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.jpg" width="50"
    height="70"
    border=0>
    <%
    elseif
    CheckPath(img_name & ".gif")=true then
    %>
    <IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.gif" width="50"
    height="70"
    border=0>
    <%
    else
    %>
    <img src="../images/70pixelsTall/noimage70.jpg" width="50" height="70"
    border=0>
    <%end if%>

    --
    Mike Brind
    Mike Brind, Apr 13, 2006
    #2
    1. Advertising

  3. Zen Masta

    Zen Masta Guest

    Thanks. But that's actually what I tried originally, well not exactly. You
    put the & ".jpg" inside the 2nd parentheses and I left it out as it was.
    However, I did try to copy and paste your code over mine and I got the same
    syntax error:

    Microsoft VBScript compilation error '800a03ea'
    Syntax error
    /search.asp, line 909
    elseif
    ------^
    Zen Masta, Apr 13, 2006
    #3
  4. Zen Masta

    Mike Brind Guest

    "Zen Masta" <> wrote in
    news::

    > Thanks. But that's actually what I tried originally, well not exactly.
    > You put the & ".jpg" inside the 2nd parentheses and I left it out as
    > it was. However, I did try to copy and paste your code over mine and I
    > got the same syntax error:
    >
    > Microsoft VBScript compilation error '800a03ea'
    > Syntax error
    > /search.asp, line 909
    > elseif
    > ------^
    >
    >
    >


    Yeah - google shoved a line break after elseif where there shouldn't be
    one.

    elseif CheckPath(img_name & ".gif")=true then

    should all be on one line.

    --
    Mike Brind
    Mike Brind, Apr 13, 2006
    #4
  5. Zen Masta

    Zen Masta Guest

    Still no luck.
    yourcode
    Microsoft VBScript compilation error '800a03f9'
    Expected 'Then'
    search.asp, line 909
    elseif img_name=rs("ISBN")
    --------------------------^
    mine
    Microsoft VBScript compilation error '800a03f9'
    Expected 'Then'
    /search2.asp, line 910
    elseif img_name=rs("ISBN") & ".gif"
    -----------------------------------^
    Zen Masta, Apr 13, 2006
    #5
  6. Zen Masta

    Zen Masta Guest

    never mind, i had a typo. thanks !
    Zen Masta, Apr 13, 2006
    #6
  7. Zen Masta

    Mike Brind Guest

    "Zen Masta" <> wrote in news:eN1LIyzXGHA.3848
    @TK2MSFTNGP05.phx.gbl:

    > Still no luck.
    > yourcode
    > Microsoft VBScript compilation error '800a03f9'
    > Expected 'Then'
    > search.asp, line 909


    How many??!?

    > elseif img_name=rs("ISBN")
    > --------------------------^


    I don't see that line anywhere in the code I posted.


    --
    Mike Brind
    Mike Brind, Apr 13, 2006
    #7
  8. Zen Masta

    Zen Masta Guest

    No, I got it to work I had just had a typo... I accidentally put the elseif
    before img_name=rs("ISBN") instead of CheckPath
    Zen Masta, Apr 13, 2006
    #8
  9. Zen Masta

    Mike Brind Guest

    "Zen Masta" <> wrote in
    news:ujRmK$:

    > No, I got it to work I had just had a typo... I accidentally put the
    > elseif before img_name=rs("ISBN") instead of CheckPath
    >
    >
    >


    Given the number of lines in your search.asp, you might find some useful
    advice here: http://www.aspfaq.com/show.asp?id=2424

    --
    Mike Brind
    Mike Brind, Apr 13, 2006
    #9
  10. Zen Masta

    Zen Masta Guest

    Thanks for the link. I'll keep it for my own references. Unfortunately I'm
    not really a programmer and so I'm not the one that wrote the site. I was
    asking for help on this problem because the programmers were trying to tell
    me it would take 8 hours to impliment this change on 6 pages. I knew this
    was rediculously overtimed since I was able to figure out what changes need
    to be made (with your help) with not much effort.

    long story short programmers are from india
    Zen Masta, Apr 13, 2006
    #10
  11. Zen Masta

    Bob Lehmann Guest

    > long story short programmers are from india
    Yes, but they only get paid $5.00 an hour.

    Bob Lehmann

    "Zen Masta" <> wrote in message
    news:%...
    > Thanks for the link. I'll keep it for my own references. Unfortunately I'm
    > not really a programmer and so I'm not the one that wrote the site. I was
    > asking for help on this problem because the programmers were trying to

    tell
    > me it would take 8 hours to impliment this change on 6 pages. I knew this
    > was rediculously overtimed since I was able to figure out what changes

    need
    > to be made (with your help) with not much effort.
    >
    > long story short programmers are from india
    >
    >
    Bob Lehmann, Apr 14, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roland
    Replies:
    0
    Views:
    1,042
    Roland
    May 12, 2004
  2. Matthias
    Replies:
    5
    Views:
    414
    Whitecrest
    Jun 1, 2004
  3. Beauregard T. Shagnasty

    Re: filename.gif or filename.gif.jpg?

    Beauregard T. Shagnasty, May 30, 2008, in forum: HTML
    Replies:
    1
    Views:
    737
    Jonathan N. Little
    May 30, 2008
  4. Bergamot
    Replies:
    0
    Views:
    443
    Bergamot
    May 30, 2008
  5. David. E. Goble
    Replies:
    8
    Views:
    82
    Dr John Stockton
    May 24, 2005
Loading...

Share This Page