WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

Du bist nicht angemeldet.

#1 05.09.2021 22:55:37

losttrip
Mitglied

News with Images - Deleted Preview Image leaves div code behind

WBCE Version: 1.5.0
Day: 1.5.0
PHP Version: 7.4.22
News with Images ver 5.0.7

Just an FYI

If I add a preview image to a post, and then delete it later, the teaserpic div with the link and a blank img source remains behind.  This displays as additional space of one blank line on the front end.

<div class="mod_nwi_teaserpic">
       <a href="https://www.mysite.com/posts/welcome-21/"><img src=""></a>					
</div>

Beitrag geändert von losttrip (06.09.2021 06:38:56)

Offline

#2 06.09.2021 06:33:55

florian
Administrator

Re: News with Images - Deleted Preview Image leaves div code behind

This is the default output if a post has no teaser image, it also appears if a post is published without having a preview image (eg it has not to be deleted). It's the wanted behaviour. To avoid this:

find in  /modules/news_img/functions.inc.php

$post_img = "<img src='".WB_URL."/modules/news_img/images/nopic.png' alt='empty placeholder' style='width:".$previewwidth."px;' />";

and change it to

$post_img = "";

Code allein macht nicht glücklich. Jetzt spenden!

Offline

Liked by:

losttrip

#3 06.09.2021 07:13:48

losttrip
Mitglied

Re: News with Images - Deleted Preview Image leaves div code behind

Thank you for your explanation.

I have to apologize, I just realized it is the output of a NIA code section which is showing this behaviour.  And it's not because of a deleted Preview image.  It has to do with the NIA display code, when there is a Long Description (or Gallery).

The code for posts with a Long Description display:

<div class="mod_nwi_teaserpic">
       <a href="https://www.mysite.com/posts/welcome-21/"><img src=""></a>					
</div>

Which creates a blank vertical space.

Where as those without a long description dsiplay:

<div class="mod_nwi_teaserpic">
</div>

And there is no space added.

I hope this clears up my issue.  I am sure if has to do with the NIA code below.

<div class="mod_nwi_teaserpic">
					{% if (news.CONTENT_LONG or news.HASGALLERYIMAGES) %}
					<a href="{{ news.LINK }}">{% endif %}<img src="{{ news.IMAGE }}" />{% if (news.CONTENT_LONG or news.HASGALLERYIMAGES) %}</a>{% endif %}
					

I added the if statements for the link because I did not want to have the cursor: no-drop behaviour on preview images when there was no long content.


This is the full code of the display mode.

<div class="mod_nia">
	<h2 class="latest_news">{{ lang.TXT_HEADER }}</h2>
	
	{% for news in newsItems %}
		{% if news.TS_POSTED_WHEN > 0 %}
			
			<div class="mod_nwi_group">
				<div class="mod_nwi_teaserpic">
					{% if (news.CONTENT_LONG or news.HASGALLERYIMAGES) %}
					<a href="{{ news.LINK }}">{% endif %}<img src="{{ news.IMAGE }}" />{% if (news.CONTENT_LONG or news.HASGALLERYIMAGES) %}</a>{% endif %}
					
					
				</div>
				
				<div class="mod_nwi_teasertext">
					<h3>{{ news.TITLE }}</h3>
					<div class="mod_nwi_metadata"><!--{{ news.DISPLAY_NAME }} | -->{{ news.TS_PUBLISHED_WHEN | date(lang.DATE_FORMAT) }}</div>
					{{ news.GROUP_IMAGE }} 
					<div class="mod_nwi_shorttext">
						{{ news.CONTENT_SHORT}}
					</div>
				</div>
				
				{% if (news.CONTENT_LONG or news.HASGALLERYIMAGES) %}
					<a href="{{ news.LINK }}">{{ lang.TXT_READMORE }}</a>
				{% endif %}
				<div class="mod_nwi_spacer"><hr /></div>
				
			</div>
			
		{% endif %}
	
	{% else %}
		{{ lang.TXT_NO_NEWS }}
	{% endfor %}

</div>

Beitrag geändert von losttrip (09.09.2021 00:10:57)

Offline

#4 06.09.2021 07:42:53

florian
Administrator

Re: News with Images - Deleted Preview Image leaves div code behind

The no-drop cursor

NWI: functions.inc.php, remove "style="cursor:no-drop;'" from l. 1169 & 2226

if ( (strlen($post['content_long']) < 9) && ($anz_post_img < 1)) {
            $post['post_link'] = '#" onclick="javascript:void(0);return false;" style="cursor:no-drop;';
        }

NIA does afaik not create a no-drop cursor.


Code allein macht nicht glücklich. Jetzt spenden!

Offline

Liked by:

losttrip

#5 09.09.2021 00:23:52

losttrip
Mitglied

Re: News with Images - Deleted Preview Image leaves div code behind

Thank you for your help.
Sorry for the slow reply.  For some reason I get email notifications for replies to some (not all) of my thread days later.

I implemented your suggestions from #2 and #4 and that achieved our desired effect, THANK YOU!

PLEASE IGNORE THE FOLLOWING.  I think I have confused the issue.  I will respond, if/when I need more help.

Thank you again!


IGNORE...
I still a related issue I need to resolve.  I have css code for link tags (border shadow etc.), so even though the cursor doesn't change on hover of the "non-link" the image styles still activate, which is confusing, since there is no link.  Sorry, if this is confusing.  I have a NWI section, and I would like to implement the same sort of IF statement to only show the Link code IF there is a Long Description or a Gallery in the Loop code below:

<div class="mod_nwi_teaserpic">
        <a class="news_img_teaserpic" href="[LINK]">[IMAGE]</a>
    </div>

This was solved in NIA sections by implementing this code, which only outputs the link code IF Long Description has content or a Gallery:

{% if (news.CONTENT_LONG or news.HASGALLERYIMAGES) %}
					<a href="{{ news.LINK }}">{% endif %}<img src="{{ news.IMAGE }}" />{% if (news.CONTENT_LONG or news.HASGALLERYIMAGES) %}</a>{% endif %}
					

Beitrag geändert von losttrip (09.09.2021 00:40:00)

Offline

Fußzeile des Forums

up