Forum
HTML tags visible when using textarea and perch_events_custom();
The required field eventDescHTML
in the Event App is a textarea
. When I view an event listing using the Basic Calendar Listing that's included with the example files everything looks fine. However, when I view a listing using perch_events_custom()
, HTML tags are visible in the browser:
Basic Calendar Listing: 'This is an event description'
perch_events_custom(): '<p>This is an event description</p>'
This only happens when a textarea
is used in combination with perch_events_custom()
.
Here is my eventDescHTML
tag:
<perch:events id="eventDescHTML" type="textarea" textile="true" editor="markitup" encode="false" />
Here is how I'm calling the template:
<?php
perch_events_custom(array(
'filter' => 'eventSlug',
'match' => 'eq',
'value' => perch_get('s'),
'template' => 'event_detail.html'
));
?>
Thank you
Can you show us your diagnostics?
Is that template tag from
event_detail.html
?(above) It's the default tag that's in
event.html
in the Events App folder. I copiedevent.html
intoperch/templates/events
to add additional tags, but I haven't modifiedeventDescHTML
.In
event_detail.html
, where I've reused the tag, It looks like this:You're missing the
type
attribute from the tag inevent_detail.html
.I had
type="textarea"
on there before and it still didn't fix the problem. I also triedtype="text"
and that didn't work either.However, I did find that adding
encode="false"
on the tag inevent_detail.html
finally prevented the HTML from being encoded. So, the tag inevent_detail.html
looks like this now:encode="false"
was already set on the tag inevent.html
but for some reason it wasn't having any effect.The remaining problem is that neither Markdown or Textile syntax is working. When I set
textile="true"
ormarkdown="true"
, the Markitup editor will insert the correct syntax but it won't produce the desired result in HTML.Here's what it looks like in the editor:
Result in browser:
Source code in console:
It seems like Textile isn't being processed correctly.
In Textile you need to leave a line between block level elements.
That fixed it! I'd never used Textile before and in my haste to fix the problem I didn't look over the documentation as much as I should have.
So, it looks like the actual problem was not having
encode="false"
oneventDescHTML
when it was reused in my custom template.Thanks for all your help, Drew!