Forum
Link from event description not working
I am using the event add on.
When editing an event, I would like to add a link to a url from the event description, but when I use the link icon the link isnt added correctly.
EG I edit an event and click the link icon to add a link to the event description - this is what I create : This is the link or sometimes This is the link...
What I see on the website is : This is the link (which is not clickable).
If I am editing a page with a text area, I can add a link using the text icon with no problems. Its just a problem with the event addon.
I have used several formats in the event.html template. None of them work for me.
~~~
<div class="description"><perch:events id="eventDescHTML" type="textarea" label="Text" markdown="true" editor="simplemde" /></div>
<div class="description"><perch:events id="eventDescHTML" type="textarea" striptags="true" markdown="true" editor="simplemde" html="true" size="m" encode="false" /></div>
<div class="description"><perch:events id="eventDescHTML" type="textarea" markdown="true" editor="markitup" encode="false" /></div>
~~~
Can anyone see what I am doing wrong?
Hi Cow Shed!
If you use the same ID on each tag then you are going to get into a bit of a pickle as Perch will assume they are the same element. Give them different names / add numbers to the ends of the ID.
You haven't said how you are generating links but I am assuming you are clicking the editor toolbar. Simplemde will insert the markdown into the copy for you to fill out. This then gets converted to html. If you add html="true" to the then you can add html into that copy too. Otherwise html will be displayed as raw code.
The first option will work fine, as will the last. Both editors will convert markdown to html on the fly. You don't need encode="false" – I don't even know what that does tbh!
The second one will strip tags out of the copy so you definitely don't want that!
ps I have never used events but am assuming it's the same as content, just rescoped. NB The events app is no longer updated as far as I am aware.
Hope this helps.
Jon
Hi Jon
Thanks for this.
Yes, you are right - I am clicking on the editor toolbar to generate the link. I only have one line of code live (the other two were just things I tried) so my id is ok.
I have tried adding html="true" but its not helping. This is the full event.html code with html true added. (Because of the problems with attaching a document in the event module, I have added a file field).
This generates this line in my Description field : This should be clickable so I can click to go to the url...
You can see the problem on my live site : https://www.cannizaropark.com/index.php Its in the PINK Forthcoming Event section at the bottom - you will see the link is not clickable!
Looking at your page source you've got output that is breaking the html. The hidden second block of html contains the working link.
Jon
Thanks so much Jon. That helped me fix this.
In the end I added a separate field for the URL without striptags=true (I need striptags=true to get rid of the <p> tags so I can change the text colour on the description). Its a shame I cant have the URL without striptags but I can see now it wont work if I add that in.
So my working code is event.html and custom-listing-day.html. Bit clunky - I expect there is a better way, but at least this is working ok
Event.html :
and I call the events using custom-listing-day :
Great news. Incidentally, why would you need to strip the p tags in your text output? Surely that defeats the point of having an editor field? Perhaps you could add the white text class to the containing element rather than the paragraph. Or you can target any p tags inside that container without having to add classes to each line with a sibling selector e.g. ul li > p or similar.
Jon