WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 22.10.2019 03:56:36

losttrip
Member

News with Images Anywhere doesn't show Read More unless Long content

I have some posts which do not have any content in the Content Long Text box, but do have some photos in the gallery.

In News with Images, the Read More link appears in this case because I assume the check must look for Content Long OR images

<span style="visibility:[SHOW_READ_MORE];"><a href="[LINK]">[TEXT_READ_MORE]</a></span>

But in News with Images Anywhere, the Read More link does not appear because the Template looks for"news.CONTENT_LONG" and since there is nothing in the Content Long it skips the Read More link.

{% if news.CONTENT_LONG %}
				<a href="{{ news.LINK }}">{{ lang.TXT_READMORE }}</a>
			{% endif %}

Is there a way to make Anywhere check or both Content Long AND Images in the photo gallery?

Offline

#2 22.10.2019 07:54:14

florian
Administrator

Re: News with Images Anywhere doesn't show Read More unless Long content

I see the problem.

1. The really quick&dirty solution: Just hit Return one time in the long text field and save.

2. You can either change the lines in the /modules/news_img_anywhere/templates/display_mode_1.htt (or the template you use)

{% if news.CONTENT_LONG %}
<a href="{{ news.LINK }}">{{ lang.TXT_READMORE }}</a>
{% endif %}

to

<a href="{{ news.LINK }}">{{ lang.TXT_READMORE }}</a>

This leads to that the read more link is always displayed, even if there's neither a long text nor there are gallery images.

3. To avoid this, you have to apply changes to the news_img_anywhere/include.php file too:

In the /modules/news_img_anywhere/include.php, after

$nimage = $row['image'];
if ($row['image']!='' && file_exists(WB_PATH . MEDIA_DIRECTORY . '/.news_img/'.$row['post_id'].'/' . $nimage)) {
	$nimage =  WB_URL . MEDIA_DIRECTORY . '/.news_img/'.$row['post_id'].'/' . $nimage;
}

add

$hasgalleryimages = false;
$sql_result = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_img_img WHERE post_id = ".$row['post_id']);
$anz_post_img = $sql_result->numRows();
if ($anz_post_img>0) {$hasgalleryimages=true;}

after

'IMAGE'              => $nimage,

add

'HASGALLERYIMAGES'	 => $hasgalleryimages

in the /modules/news_img_anwhere/templates/display_mode_1.htt (or the template you use) change

{% if news.CONTENT_LONG %}

to

{% if (news.CONTENT_LONG or news.HASGALLERYIMAGES) %}

So the read more link will also appear if there is no long text, but gallery images.


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

Liked by:

giz, losttrip

#3 22.10.2019 15:33:05

losttrip
Member

Re: News with Images Anywhere doesn't show Read More unless Long content

I chose option three and it works beautifully.  Thank you!

I had already considered option 1, but telling clients they have to hit return in a blank text box would likely just lead to future headaches... because they wouldn't remember to do it.

I tried option 2 already, but clicking Read More on a post with no long content, would lead to a page with nothing more than duplicate content which is not a good user experience.

So, I am very happy you took the time to provide a full solution.  Perhaps this could be considered as part of the next version?

-------------

A quick note - I initially went to edit the include.php file through cwsoft-addon-file-editor and the editor showed no content:
ed0ad4cd039700f999afe87a511ca415.png

I then went into the file on my server and the content was there.  Any idea why the cwsoft-addon-file-editor  wouldn't show the content of include.php?

Offline

#4 22.10.2019 16:58:45

webbird
Administrator

Re: News with Images Anywhere doesn't show Read More unless Long content

Just as a side note, I created an issue for NWI (not "Anywhere") to fix it there, too.


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

Liked by:

losttrip

#5 22.10.2019 17:31:28

florian
Administrator

Re: News with Images Anywhere doesn't show Read More unless Long content

A quick note - I initially went to edit the include.php file through cwsoft-addon-file-editor and the editor showed no content:

The NIA files are saved in ANSI charset instead of UTF-8 unfortunately, and the AFE fails to load them.


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

#6 23.10.2019 07:35:29

florian
Administrator

Re: News with Images Anywhere doesn't show Read More unless Long content

I've published a bugfix release 0.1.2 with all files converted to UTF-8 and the changes to the include.php / display_mode_1.htt mentioned above.


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

Liked by:

webbird, losttrip

#7 09.03.2020 22:57:29

losttrip
Member

Re: News with Images Anywhere doesn't show Read More unless Long content

I just upgraded NWI anywhere from 0.1.2 to 0.3 (from the AOR - https://addons.wbce.org/pages/addons.ph … m&item=115 ) and 0.3 doesn't seem to have the $hasgalleryimages fixes you implemented.  So, once again, when I have ONLY a gallery on the details page, there is no "read more" link on the overview page.

Offline

#8 10.03.2020 08:25:01

florian
Administrator

Re: News with Images Anywhere doesn't show Read More unless Long content

Pls find the fixed version in the AOR


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

Liked by:

losttrip

#9 10.03.2020 18:53:17

losttrip
Member

Re: News with Images Anywhere doesn't show Read More unless Long content

Thank you for your effort.  Works as expected.   thumb_up

Offline

Board footer

up