Re: add variable within href?

A

Adrienne

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.
 
A

Adrienne

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;
..
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top