Forum

Thread tagged as: Problem

Caleb,

Your original template is working correctly and when you output the data using the original template it works as expected.

When you use perch_collection() and "skip-template" this only removes the template from the output, however the HTML which was added to the textarea at edit is still output.

Then, when you send this output to perch_template() if you use the original template which has an editor specified on the textarea it add's HTML around the HTML you passed in. the encode="false" only applies to the New HTML not the existing HTML you passed in.

This is why a second template is required if you want to avoid additional HTML from being applied around the HTML you passed in.

When you use <perch:content id="your_id" encode="false" /> in your second template used by perch_template()` no additional HTML will be added, and any HTML on the string you pass in will not be encoded.

Apologies. I thought you were asking for a live example.

This template field is part of the template that defines my collection (full template is in first post if you need it).

<perch:content id="testament" type="textarea" label="Testament" markdown="true" editor="markitup" required="true" encode="false"  />

It just has test entered into it in the back end (just text at the moment, no other formatting) but technically it is Markdown.

I'm using perch_collection() to get the data as detailed above. The field in question looks like this using var_dump on the collection item.

["testament"]=>
  string(518) "<p>Curabitur blandit tempus porttitor. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum id ligula porta felis euismod semper.</p>"

when rendered to the page using perch_template() it looks like.

<p>&lt;p&gt;Curabitur blandit tempus porttitor. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum id ligula porta felis euismod semper.&lt;/p&gt;</p>

Thanks Robert.

I think I understand now.

Thanks Robert. Now I understand what is happening, it is working as expected.

Apologies for the confusion Drew.