Events Made Easy › Forums › Bug fixed or feature request implemented › Issue with Version 2.2.22
- This topic has 19 replies, 2 voices, and was last updated 3 years, 2 months ago by Anonymous.
-
AuthorPosts
-
Thu 23 Sep 2021 at 16:32 #63211AnonymousInactive
Hi Franky
I’ve just updated two websites that I manage to Version 2.2.22 of EME – and both are experiencing the same issue.
Every page on the site displaying any EME info, whether it be listings templates or event info has a lot of extra <br> tags throughout, creating issues with spacing on all elements.
</p> have one extra <br> afterwards
</div> have <br> tags afterwards – sometimes one, sometimes two.
Is there anything that could be causing this in the new update?
I’ve checked, and all be templates have “Convert newlines” set to “No”
Cheers
JamieThu 23 Sep 2021 at 17:46 #63212FrankyKeymasterWell, see this from the changelog:
* Some more nl2br where neededBut it seems the function is still not smart enough. Try and see if this changeset helps:
Thu 23 Sep 2021 at 18:10 #63213AnonymousInactiveUnfortunately that line change didn’t work.
Removing lines 2016 and 2017 did work, but that’s probably not ideal
adding the ‘p’ before the tr’ below did work for the text paragraphs, but not the ‘div’ (or ‘hr’ or ‘a’
if (!preg_match("#</?(tr|td|th|tbody|li)[^/<>]*>\s*$|<(table|ol|ul)[^/<>]*>\s*$#", $line))
Thu 23 Sep 2021 at 23:13 #63214FrankyKeymasterCan you give an example of a template containing this p, div and hr-tags?
Concerning the a-tag: that’s a link, so not a containing tag like the others (or hr).Edit: try this changeset, this is simpler coding and should work for div/hr too:
https://plugins.trac.wordpress.org/changeset/2603946/Fri 24 Sep 2021 at 00:11 #63215FrankyKeymasterEdit: even more simplified if and also taking into account hidden input-fields and eme_if (although the input field is not really needed, but anyway):
if (!preg_match("#</?(p|div|tr|td|th|tbody|li|table|ol|ul|hr).*?>\s*$|<input[^/<>]*hidden.*?>\s*$|\[\/?eme_if.*?\]\s*$#", $line))
Fri 24 Sep 2021 at 10:50 #63221AnonymousInactiveHi Franky
Thanks for looking into this. Unfortunately it didn’t resolve the issue for <div> tags or <hr>. Also, I’ve seen it is occurring after
<li>
tags in the EME widget, as well as after<img />,
<h1>, <h2> etc.I’ve included some samples below
Fri 24 Sep 2021 at 10:59 #63226FrankyKeymasterDid you try the latest code? I saw some weird posts here that I had to approve …
Fri 24 Sep 2021 at 11:01 #63227FrankyKeymasterAnd also, try this code:
if (!preg_match("#</?(\w+).*?>\s*$|\[\/?eme_if.*?\]\s*$#", $line))
What that does is: any html-tag that ends on a line won’t get a br after it
Fri 24 Sep 2021 at 11:14 #63228AnonymousInactiveHi Franky – sorry, I posted too many times as I thought there was an error with my IMG attachments.
I’ve tried your previous code:
if (!preg_match("#</?(p|div|tr|td|th|tbody|li|table|ol|ul|hr).*?>\s*$|<input[^/<>]*hidden.*?>\s*$|\[\/?eme_if.*?\]\s*$#", $line))
and now have tried this latest code:
if (!preg_match("#</?(\w+).*?>\s*$|\[\/?eme_if.*?\]\s*$#", $line))
It seems to fix most html tags except for <div> and
<li>
Same as before:
tags inserted after <div>” />tags inserted after
<li>
in EME widget” />Fri 24 Sep 2021 at 11:16 #63229FrankyKeymasterIt is possible your code contains other issues. Can you post the html-code? And please use the “code” button, otherwise your reply gets pending or marked as spam.
Fri 24 Sep 2021 at 11:17 #63230FrankyKeymasterOr a link to your event?
Fri 24 Sep 2021 at 11:47 #63231AnonymousInactiveHi Franky
I think I see what the issue is – all my templates use tab spacing – the update seems to be adding <br> tags to tabbed spaces, when I minify the code in my template, it resolves the issue.
However, as I manage multiple sites, I would have to go through every template on each site to minify. Is there a way of resolving it in the eme_functions.php?
<div class="single-event-container"> <div class="row"> <div class="col-md-8"> <div class="single-event-content"> <div class="single-event-image-div"> <img src="#_EVENTIMAGEURL" width="100%" alt="#_EVENTNAME" title="#_EVENTNAME"> <div class="single-event-title-background"><div class="single-event-title">#_ATT{EVENT_TITLE}</div></div> [events_if tag='#ESC_CATEGORIES' contains='Full']<div class="fully-booked"><img src="https://culturenightcork.ie//wp-content/themes/culturenightcork/theme/img/events/fully-booked.png"></div>[/events_if] </div> <div class="single-event-sidebar-info-mobile d-md-none"> <h2>#_EVENTNAME</h2> [events_if tag='#ESC_CATEGORIES' contains='In Venue']<div class="single-event-in-venue" title="This event takes place indoors at #_EVENTNAME"><i class="fas fa-map-marker-alt"></i> In Venue</div> <div><b>#_LOCATIONNAME</b><br> #_ADDRESS<br></div>[/events_if] [events_if tag='#ESC_CATEGORIES' contains='Outdoors']<div class="single-event-outdoors" title="This is an outdoor event"><i class="fas fa-cloud-moon"></i> Outdoors</div> <div><b>#_LOCATIONNAME</b><br> #_ADDRESS<br></div>[/events_if] [events_if tag='#ESC_CATEGORIES' contains='Online']<div class="single-event-online" title="This is an online event"><i class="fa fa-bullseye"></i> <b>Online</b></div>[/events_if] <hr> <b>Time:</b> #g:#i#a - #@g:#@i#@a<br> <hr> [events_if tag="#_ATT{PHONE_NUMBER}" ]<b>Phone:</b> #_ATT{PHONE_NUMBER}<br> <hr>[/events_if] [events_if tag="#_ATT{WEB_ADDRESS}" ] <b>Web:</b> <div style="overflow:hidden"><a href="#_ATT{WEB_ADDRESS}" target="_blank">#_ATT{WEB_ADDRESS}</a></div>[/events_if] [eme_if tag='#ESC_FIELDVALUE{3}']<a class="event-social-link facebook" href="https://#_FIELDVALUE{3}" target="_blank" title="Go to https://#_FIELDVALUE{3}"><i class="fab fa-facebook-f"></i></a>[/eme_if] [eme_if tag='#ESC_FIELDVALUE{5}']<a class="event-social-link twitter" href="https://#_FIELDVALUE{5}" target="_blank" title="Go to https://#_FIELDVALUE{5}"><i class="fab fa-twitter"></i></a>[/eme_if] [eme_if tag='#ESC_FIELDVALUE{4}']<a class="event-social-link instagram" href="https://#_FIELDVALUE{4}" target="_blank" title="Go to https://#_FIELDVALUE{4}"><i class="fab fa-instagram"></i></a>[/eme_if] [eme_if tag='#ESC_FIELDVALUE{6}']<a class="event-social-link youtube" href="https://#_FIELDVALUE{6}" target="_blank" title="Go to https://#_FIELDVALUE{6}"><i class="fab fa-youtube"></i></a>[/eme_if] [eme_if tag='#ESC_FIELDVALUE{7}']<a class="event-social-link vimeo" href="https://#_FIELDVALUE{7}" target="_blank" title="Go to https://#_FIELDVALUE{7}"><i class="fab fa-vimeo"></i></a>[/eme_if] <hr> [events_if tag='#ESC_CATEGORIES' contains='Childrens Event']<b>Childrens event?:</b> Yes. This event is specifically aimed for children.<br> <hr>[/events_if] [events_if tag="#_ATT{CHILD_FRIENDLY}" ]<b>Child friendly?:</b> #_ATT{CHILD_FRIENDLY}<br> <hr>[/events_if] [events_if tag="#_ATT{BOOKING_NEEDED}"]<b>Booking required?:</b> #_ATT{BOOKING_NEEDED}<br> <hr>[/events_if] [events_if tag="#_ATT{BOOKING_LINK}"]<b>Booking Link:</b> <a href="#_ATT{BOOKING_LINK}" target="_blank">#_ATT{BOOKING_LINK}</a><br> <hr>[/events_if] [events_if tag="#_ATT{WHEELCHAIR_ACCESSIBLE}" contains="Yes"]<b>Wheelchair Accessible?</b>: #_ATT{WHEELCHAIR_ACCESSIBLE}<br> <hr>[/events_if] <b>Categories:</b> #_EVENTCATEGORIES{}{35,36,37,38}<br> <hr> [ssba] </div> <div class="single-event-notes">#_NOTES</div> [eme_if tag='#ESC_FIELDVALUE{8}']<h3>#_FIELDVALUE{9}</h3> [arve url="#_FIELDVALUE{8}" /] [/eme_if] [events_if tag='#ESC_CATEGORIES' contains='In Venue'] <div class="single-listing-map-title"> Map: #_LOCATIONNAME </div> <div class="single-listing-map">#_MAP</div> [/events_if] [events_if tag='#ESC_CATEGORIES' contains='Outdoors'] <div class="single-listing-map-title"> Map: #_LOCATIONNAME </div> <div class="single-listing-map">#_MAP</div> [/events_if] </div> </div> <div class="col-md-4 d-none d-md-block"> <div class="single-event-sidebar-info"> <h2>#_EVENTNAME</h2> [events_if tag='#ESC_CATEGORIES' contains='In Venue']<div class="single-event-in-venue" title="This event takes place indoors at #_EVENTNAME"><i class="fas fa-map-marker-alt"></i> In Venue</div> <div><b>#_LOCATIONNAME</b><br> #_ADDRESS<br></div>[/events_if] [events_if tag='#ESC_CATEGORIES' contains='Outdoors']<div class="single-event-outdoors" title="This is an outdoor event"><i class="fas fa-cloud-moon"></i> Outdoors</div> <div><b>#_LOCATIONNAME</b><br> #_ADDRESS<br></div>[/events_if] [events_if tag='#ESC_CATEGORIES' contains='Online']<div class="single-event-online" title="This is an online event"><i class="fa fa-bullseye"></i> <b>Online</b></div>[/events_if] <hr> <b>Time:</b> #g:#i#a - #@g:#@i#@a<br> <hr> [events_if tag="#_ATT{PHONE_NUMBER}" ]<b>Phone:</b> #_ATT{PHONE_NUMBER}<br> <hr>[/events_if] [events_if tag="#_ATT{WEB_ADDRESS}" ] <b>Web:</b> <div style="overflow:hidden"><a href="#_ATT{WEB_ADDRESS}" target="_blank">#_ATT{WEB_ADDRESS}</a></div>[/events_if] [eme_if tag='#ESC_FIELDVALUE{3}']<a class="event-social-link facebook" href="https://#_FIELDVALUE{3}" target="_blank" title="Go to https://#_FIELDVALUE{3}"><i class="fab fa-facebook-f"></i></a>[/eme_if] [eme_if tag='#ESC_FIELDVALUE{5}']<a class="event-social-link twitter" href="https://#_FIELDVALUE{5}" target="_blank" title="Go to https://#_FIELDVALUE{5}"><i class="fab fa-twitter"></i></a>[/eme_if] [eme_if tag='#ESC_FIELDVALUE{4}']<a class="event-social-link instagram" href="https://#_FIELDVALUE{4}" target="_blank" title="Go to https://#_FIELDVALUE{4}"><i class="fab fa-instagram"></i></a>[/eme_if] [eme_if tag='#ESC_FIELDVALUE{6}']<a class="event-social-link youtube" href="https://#_FIELDVALUE{6}" target="_blank" title="Go to https://#_FIELDVALUE{6}"><i class="fab fa-youtube"></i></a>[/eme_if] [eme_if tag='#ESC_FIELDVALUE{7}']<a class="event-social-link vimeo" href="https://#_FIELDVALUE{7}" target="_blank" title="Go to https://#_FIELDVALUE{7}"><i class="fab fa-vimeo"></i></a>[/eme_if] <hr> [events_if tag='#ESC_CATEGORIES' contains='Childrens Event']<b>Childrens event?:</b> Yes. This event is specifically aimed for children.<br> <hr>[/events_if] [events_if tag="#_ATT{CHILD_FRIENDLY}" ]<b>Child friendly?:</b> #_ATT{CHILD_FRIENDLY}<br> <hr>[/events_if] [events_if tag="#_ATT{BOOKING_NEEDED}"]<b>Booking required?:</b> #_ATT{BOOKING_NEEDED}<br> <hr>[/events_if] [events_if tag="#_ATT{BOOKING_LINK}"]<b>Booking Link:</b> <a href="#_ATT{BOOKING_LINK}" target="_blank">#_ATT{BOOKING_LINK}</a><br> <hr>[/events_if] [events_if tag="#_ATT{WHEELCHAIR_ACCESSIBLE}" contains="Yes"]<b>Wheelchair Accessible?</b>: #_ATT{WHEELCHAIR_ACCESSIBLE}<br> <hr>[/events_if] <b>Categories:</b> #_EVENTCATEGORIES{}{35,36,37,38}<br> <hr> [ssba] </div> </div> </div> </div>
Link to event: https://culturenightcork.ie/events/crawford-art-gallery/
Fri 24 Sep 2021 at 11:56 #63232FrankyKeymasterTrying your example here: the “problem” is the use of the older events_if for conditional tags.
I no longer advertise that, but since it still works I should account for it 🙂 But you’re mixing the 2 btw (events_if and eme_if)
Try this:
if (!preg_match("#</?(\w+).*?>\s*$|\[\/?(eme|events)_if.*?\]\s*$#", $line))
Now, you also have empty lines in your template. That of course is up to you to decide on those.
Fri 24 Sep 2021 at 12:15 #63233AnonymousInactiveHi Franky
Ok thanks. I see that about the events_if and eme_if – I’ll be sure to use eme_if from now on
This last code fixed seems to have resolved most of the issues, and any issues it did not resolve, were due to line spaces in my template code. I will need to go through all of these.
However, up until this update, they did not cause a problem – and there may be many others like me (who are not natural developers) who might have empty lines in their templates. It may cause issues for them.
Cheers
JamieFri 24 Sep 2021 at 14:35 #63235FrankyKeymasterThanks for confirming this. Concerning other users: there was 1 other person and he also confirmed the change solved it. I guess I didn’t take into account people putting that much work in templating 🙂 But glad it got fixed!
Wed 29 Sep 2021 at 11:00 #63248AnonymousInactiveHi Franky
I’ve seen you’ve implemented a fix for this in Version 2.2.23
There is one further query I have on this. With regards to the template code below
<div class="single-event-date-mobile"> #D #j #M #Y [eme_if tag="#ESC_CATEGORIES" contains="Live Music"]<br>#g:#i#a[/eme_if] </div>
When this is output, an extra <br> still appears after the #Y (the year)
There is a <br> in the conditional statement below it, but there are two <br> tags output in the HTML. Is it because #D #j #M #Y is not in any HTML tags. Does that mean that all placeholders need to be in some kind of HTML tag from now on? They can no longer just be placed in a template as they are?
Thanks
JamieWed 29 Sep 2021 at 12:02 #63249FrankyKeymasterUse this:
<div class="single-event-date-mobile"> #D #j #M #Y [eme_if tag="#ESC_CATEGORIES" contains="Live Music"]<br>#g:#i#a[/eme_if] </div>
Maybe I should also take [eme_if] on a newline into account to not set a br before it. Try this on line 2009 in eme_functions.php:
if (!preg_match("#^\s*</?|^\s*\[\/?(eme|events)_if#",$lines[$i+1]))
Wed 29 Sep 2021 at 12:56 #63250AnonymousInactiveHi Franky
In the eme_functions.php – line 2009:
Existing code adds a <br> after the the #D #j #M #Y output
if (!preg_match("#</?(\w+).*?>\s*$|\[\/?(eme|events)_if.*?\]\s*$#", $line))
when I replace it with the new line you suggested, it adds a <br> before the #D #j #M #Y output
if (!preg_match("#^\s*</?|^\s*\[\/?(eme|events)_if#",$lines[$i+1]))
When I change my template to this:
<div class="single-event-date-mobile"> #D #j #M #Y [eme_if tag="#ESC_CATEGORIES" contains="Live Music"]<br>#g:#i#a[/eme_if] </div>
It works fine with the existing eme_functions.php – line 2009, but the new code you suggested still adds a <br> before it in the output
Thanks
JamieWed 29 Sep 2021 at 13:25 #63251FrankyKeymasterYou replaced the wrong line, but apparently I gave the wrong number (based on dev). In the released version it is line 2011
Wed 29 Sep 2021 at 15:27 #63252AnonymousInactiveAh. I see that now. I’ve replaced the correct line (2011) and it’s worked perfectly. No more <br> tags
Thanks again Franky
Jamie -
AuthorPosts
- The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.