Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 VP-ASP 7.0 Questions
 Add hyperlink to Image in Body Main Content
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

chrisredco
VP-CART Super User

282 Posts

Posted - March 18 2010 :  09:44:26  Show Profile  Visit chrisredco's Homepage  Reply with Quote
I am updating the Body Main COntent section of my 7.0 upgrade site, and have uploaded my image to that part of the page. Is there a way I can make that image also have a hyperlink? Since the field referencing the image is just a field in Admin, I'm not sure where I would add a hyperlink to this part of the page.

carfin
VP-CART Expert

United Kingdom
948 Posts

Posted - March 18 2010 :  12:00:44  Show Profile  Reply with Quote
Hi,

although I'm not familiar with V7, you will most likely have to open shopcontent.asp in a text or html editor and find the following sub:

Sub formatimage (image)
Response.write "<p class=""ac"">"
response.write "<img border=""0"" src=""" & image & """ alt="" "" />"
response.write "</p>"
end sub


add your response.write"<a href=""link details etc etc"">" within this routine.

This will give you a hyperlink but it will be the same for each content record image, unless you add a check eg "if content record=whatever" then response.write"<a href........>"

I hope this helps

Regards,

Carrol
www.deanston-electrical.co.uk

Edited by - carfin on March 18 2010 12:04:17
Go to Top of Page

chrisredco
VP-CART Super User

282 Posts

Posted - March 18 2010 :  15:26:16  Show Profile  Visit chrisredco's Homepage  Reply with Quote
Thanks, but that didin't seem to work. Here is the way to make this happen, as per the fine folks at tech support:

To add a link to the image, please try the following steps:

1. Open tmp_default.htm that located under "/templates/default-3cols" (or default-2cols)folder using text editor (eg. Notepad).

2. Locate the following code:
(around line 6)

$ <img src="[ContentImage]" align="right" alt="" class="image" />

3. Change it into the following code:

$ <a href="your_redirected_page.asp"><img src="[ContentImage]" align="right" alt="" class="image" /></a>

4. Save the file and check your website to see the changes.
Go to Top of Page

carfin
VP-CART Expert

United Kingdom
948 Posts

Posted - March 19 2010 :  05:54:27  Show Profile  Reply with Quote
Glad you got it sorted.
You didn't say that it was only the home page content you wanted to add the image link to which is why I went for shopcontent.asp instead of tmp_default.htm

For anyone else looking for an easy way through the admin panel to add a hyperlink to the image in the image field of any of your content records, here's how:

In your content records use the other 2 field to add the address of the page you want the image to link to.
Open shopcontent.asp in an html or text editor
Find sub formatimage
Replace the code up to and including the end sub line with the following:

Sub formatimage (image)
dim imageurl
imageurl=crs("other2")
Response.write "<p class=""ac"">"
If imageurl="" then
response.write "<img border=""0"" src=""" & image & """ alt="" "" />"
response.write "</p>"
else response.write "<a href=""" & imageurl & """ >"
response.write "<img border=""0"" src=""" & image & """ alt="" "" />"
response.write "</a></p>"
end if
end sub


Save the file

I've tested this and it works fine

Regards,

Carrol
www.deanston-electrical.co.uk
Go to Top of Page

chrisredco
VP-CART Super User

282 Posts

Posted - March 20 2010 :  08:51:53  Show Profile  Visit chrisredco's Homepage  Reply with Quote
Nice! Sorry I was less than exact in my post. This is a great tool to know about.

Thanks again,
Chris
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00