Forum

Thread tagged as: Problem

Link not working

I have a template that allows a client to enter a url thats forms the link of a button.

The issue is that when the url contains an & anything beyond this is ignored, so although the link still takes you a the website, it doesn't take you to the correct page.

Is there anything that can be done about this?

Thanks in advance for your help.

Christian Thomas

Christian Thomas 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What does the link look like if you view source on your HTML?

The page source has the ampersand written in html code which explains the problem - is there a way to prevent this?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me the exact output?

Here's the output - the link calls a page into an iframe:

<a class="buy" href="cardgains-webshop.php?page=https://cardgains.card-manager.com/Store/Details/3606?level1=%40A&level2=1032&level3=912999&level4=9997&pageno=0&source=B">Buy Promotion</a>
Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks correct to me.

The code I posted has reverted to & - but on the page source it shows &

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great.

The original problem still exists - any ideas?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Oh, sorry, I thought you were saying it was working.

Can you show me the tag from your template for this field?

Here's the tag:

<a class="buy" href="cardgains-webshop.php?page=<perch:content id="link" type="text" label="Product url" />">Buy Promotion</a>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. So it's correct that the ampersands should be written as &amp; in the page source. The issue would arise if the ampersands were double encoded, but it doesn't sound like that's happening.