Forum
perch tag self closing slash gets removed in output
Hi,
I'm trying to set a link to a file that the client has uploaded. But by putting the perch file tag within my href, the link just breaks.
This is my HTML
<a data-popup="true" href="<perch:content id="factuurvoorwaarden" type="file" label="Factuurvoorwaarden PDF" />">factuurvoorwaarden</a>
This renders out to
<a data-popup="true" href="<perch:content id=" factuurvoorwaarden"="" type="file" label="Factuurvoorwaarden PDF">">factuurvoorwaarden</a>
As you can see the closing slash of the perch tag gets removed and the "great/smaller then" signs get replaced by their entity codes. Using this within a form, using the same HTML does work, but removes the data-popup attribute. Though that attribute is not the problem, since I have tried this without and with a target="_blank" (this gets removed as well). So i'm also not able to have it open in a new tab (this is necessary).
Any idea's as to what the issue is?
Thanks in advance!
Robin
Where are you doing this? Is it in a template?
This example is just inside the body of my index.php. The other, where I use this link at the bottom of a form (this is for terms&conditions pdf) is inside a perch region. Inside of the form the tag has the correct output, but removes my data or target attribute (whichever i use).
You can only use Perch template tags in a Perch template, not in your page.
Ok thanks for the clarification. My form is in a template and the tag does seem to work there without a problem. But still. All attributes I add to the a-tag seem to get removed. Why is that?
This piece of HTML
Gets outputted like this. Notice the "data-popup" attribute has been removed. The same happens if I add (for example) target="_blank".
Can we see your entire template and Diagnostics Report?
Of course.
TEMPLATE:
DIAGNOSTICS:
You'll need to double-check what you're seeing - Perch doesn't even have the capability to modify the markup in your template outside of its own tags.