I’m having an issue wrapping a link around some output in a template file. I have the right template file; and I can put text like ‘start here’ and ‘end here’ and it prints out where I want the ‘a href’ tag to start and end.
However when I put in the starting ‘a href’ it auto closes. I can put in a ‘div’ and that doesn’t auto close. I’ve tried
<div href="javascript:void(0)" onclick="window.location.assign("'.$link.'")” >
and although that html output looks right it doesn’t work either.
I’ve also used at ‘function l’ but can’t pass the $content in.
Any ideas how I can either stop the auto close, get the javascript to work or a function I can use to output the link but will except the content being passed in.
Here's my code
print '<a href="'.$link.'" >';
print $field->content;
print '</a>';