Re: add variable within href?

Discussion in 'HTML' started by Adrienne, Aug 18, 2003.

  1. Adrienne

    Adrienne Guest

    Gazing into my crystal ball I observed "text news"
    <> writing in
    news:1v50b.15432$:

    > Hello...
    > I am trying to create links but using a variable.
    > For example....
    > The reference number of a photograph is represented by the variable
    ><#etcShortTitle> and I want to generate pages which will do the
    >equivalent
    > of :
    > href="http://www.test.com/ <#etcShortTitle>" if you see what I mean.
    >
    > Can anyone suggest how I can incorporate the variable <#etcShortTitle>
    > into a href command.
    > I don't mind how messy it is as long as it works!
    >
    > Thanks
    >
    > Les
    >
    >


    You're not clear on what you want the href to do. Do you want to go to a
    page, or an anchor? What exactly is #etcShortTitle?

    Assuming that you're pulling out an id out of a table, and you want to
    reference that id, in ASP you could do this:

    <%
    While Not RsRecordset.EOF

    id = trim(RsRecordset("id"))

    %>
    <a href="www.example.com/somepage.asp?id=<%=id%>">Some page with picture
    </a>
    <% RsRecordset.MoveNext
    Wend
    RsRecordset.Close
    Set Rsrecordset = Nothing
    %>

    Then on somepage.asp, you would look for the id - request.querystring("id")
    - in the querystring and process from there.

    --
    Adrienne Boswell
    Please respond to the group so others can share
    http://www.arbpen.com
    Adrienne, Aug 18, 2003
    #1
    1. Advertising

  2. Adrienne

    Adrienne Guest

    Gazing into my crystal ball I observed "text news"
    <> writing in
    news:AO70b.14362$:

    >
    > "Adrienne" <> wrote in message
    > news:Xns93DB5A0D0CC5Carbpenyahoocom@207.115.63.156...
    >> Gazing into my crystal ball I observed "text news"
    >> <> writing in
    >> news:1v50b.15432$:
    >>
    >> > Hello...
    >> > I am trying to create links but using a variable.
    >> > For example....
    >> > The reference number of a photograph is represented by the variable
    >> ><#etcShortTitle> and I want to generate pages which will do the
    >> >equivalent
    >> > of :
    >> > href="http://www.test.com/ <#etcShortTitle>" if you see what I
    >> > mean.
    >> >
    >> > Can anyone suggest how I can incorporate the variable
    >> > <#etcShortTitle> into a href command.
    >> > I don't mind how messy it is as long as it works!
    >> >
    >> > Thanks
    >> >
    >> > Les
    >> >
    >> >

    >>
    >> You're not clear on what you want the href to do. Do you want to go
    >> to a page, or an anchor? What exactly is #etcShortTitle?
    >>
    >> Assuming that you're pulling out an id out of a table, and you want to
    >> reference that id, in ASP you could do this:
    >>
    >> <%
    >> While Not RsRecordset.EOF
    >>
    >> id = trim(RsRecordset("id"))
    >>
    >> %>
    >> <a href="www.example.com/somepage.asp?id=<%=id%>">Some page with
    >> picture </a> <% RsRecordset.MoveNext
    >> Wend
    >> RsRecordset.Close
    >> Set Rsrecordset = Nothing %>
    >>
    >> Then on somepage.asp, you would look for the id -
    >> request.querystring("id") - in the querystring and process from there.
    >>
    >> --

    >
    > Thanks for getting back to me.
    > Ok.... the full story....
    >
    > I use a piece of software called "Express Thumbnail Creator" (which is
    > wonderful!!!) to generate a web site of photographs.
    > It includes the ability to customise its html pages. In effect it
    > batch generates thumbnails and larger images and puts them all together
    > with index pages etc.
    > As part of this process, each photo is given a number which is used to
    > generate the links and name html pages, thumbnails and images.
    > The variable used by the program to identify each unique photo is
    ><#etcShortTitle>
    > I can use this variable to put a unique reference number under each
    > displayed photo but would also like to use it in order to link to
    > another program.
    > The other software is Mals E-Commerce which will give me shopping cart
    > facilities.
    >
    > So I need to jump out of the first program to the second using a
    > hyperlink.
    >
    > The hyperlink has to look a bit like:
    >
    > href=http://www.aitsafe.com/cf/add.cfm?userid=123456&product=xxxxx
    >
    > the xxxxx needs to be replaced with the variable represented by
    ><#etcShortTitle> so if for example the photograph reference was "AB123"
    >it
    > would end up looking like:
    >
    > href=http://www.aitsafe.com/cf/add.cfm?userid=123456&product=AB123
    >
    > I have written to the support people at Express TC but just wondered if
    > there was anyone here who might have an idea or two.
    >
    > One possibility is to manually edit each generated page of html to add
    > the right photo reference number.
    > Another is to run a sort of batch search and replace. I envisage a
    > program that will open the file, pick the correct word, say "AB123"
    > which could be the first word on the page and replace "xxxxx" with
    > "AB123". Clumsy but it might just work.
    >
    > Really though, I need to sort out the variable <#etcShortTitle> and get
    > it into the href.
    >
    > Many thanks again.... Les
    >
    >
    >


    <a href="http://www.aitsafe.com/cf/add.cfm?userid=123456&amp;product=
    <#etcShortTitle>"> should work for you. Be sure to escape the & with &amp;
    ..

    --
    Adrienne Boswell
    Please respond to the group so others can share
    http://www.arbpen.com
    Adrienne, Aug 18, 2003
    #2
    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. CRON
    Replies:
    24
    Views:
    200,487
    Adrienne Boswell
    Jun 20, 2006
  2. Soren Vejrum
    Replies:
    4
    Views:
    538
    Lasse Reichstein Nielsen
    Jul 5, 2003
  3. saiho.yuen
    Replies:
    3
    Views:
    411
    kaeli
    Sep 14, 2004
  4. Replies:
    2
    Views:
    445
  5. Vincent van Beveren

    BASE HREF and A HREF="#" onclick="..."

    Vincent van Beveren, Jul 6, 2006, in forum: Javascript
    Replies:
    2
    Views:
    297
    Vincent van Beveren
    Jul 6, 2006
Loading...

Share This Page