Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #63211
    Anonymous
    Inactive

    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
    Jamie

    #63212
    Franky
    Keymaster

    Well, see this from the changelog:
    * Some more nl2br where needed

    But it seems the function is still not smart enough. Try and see if this changeset helps:

    https://plugins.trac.wordpress.org/changeset/2603774/

    #63213
    Anonymous
    Inactive

    Unfortunately 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))

    #63214
    Franky
    Keymaster

    Can 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/

    #63215
    Franky
    Keymaster

    Edit: 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))

    #63221
    Anonymous
    Inactive

    Hi 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

    #63226
    Franky
    Keymaster

    Did you try the latest code? I saw some weird posts here that I had to approve …

    #63227
    Franky
    Keymaster

    And 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

    #63228
    Anonymous
    Inactive

    Hi 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” />

    #63229
    Franky
    Keymaster

    It 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.

    #63230
    Franky
    Keymaster

    Or a link to your event?

    #63231
    Anonymous
    Inactive

    Hi 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/

    #63232
    Franky
    Keymaster

    Trying 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.

    #63233
    Anonymous
    Inactive

    Hi 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
    Jamie

    #63235
    Franky
    Keymaster

    Thanks 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!

    #63248
    Anonymous
    Inactive

    Hi 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
    Jamie

    #63249
    Franky
    Keymaster

    Use 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]))

    #63250
    Anonymous
    Inactive

    Hi 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
    Jamie

    #63251
    Franky
    Keymaster

    You replaced the wrong line, but apparently I gave the wrong number (based on dev). In the released version it is line 2011

    #63252
    Anonymous
    Inactive

    Ah. I see that now. I’ve replaced the correct line (2011) and it’s worked perfectly. No more <br> tags

    Thanks again Franky
    Jamie

Viewing 20 posts - 1 through 20 (of 20 total)
  • The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.
Scroll to Top