Page 1 of 1

Only two attachments in the latest news in large settings

Posted: 5. February 2024 19:55
by Jambore
Hi,

What if I only need to display two attachments on the home page?

Code: Select all

{% if 2 S_HAS_ATTACHMENTS %}
??

Re: Only two attachments in the latest news in large settings

Posted: 5. February 2024 20:25
by Kirk
Where exactly should this be displayed?

Re: Only two attachments in the latest news in large settings

Posted: 5. February 2024 23:05
by Jambore
Hi,

I'm just asking how to edit the code?

If I only want to display two attachments on the portal.

Re: Only two attachments in the latest news in large settings

Posted: 6. February 2024 05:44
by Kirk
If you mean the Latest news modules, it is not possible. Either display all attachments in the post or nothing.

Re: Only two attachments in the latest news in large settings

Posted: 6. February 2024 14:24
by Jambore
Couldn't this be modified in the code?

For example, if there are six attachments, I don't want to show them all, but only two.
Otherwise the page is stretched.

Or would it be possible to order the attachments side by side using css at least?
On larger displays it would look better.

Thank you for your suggestions.

Re: Only two attachments in the latest news in large settings

Posted: 6. February 2024 17:06
by Kirk
It might be possible, but it would require many changes.
For attachments side by side, look here: Horizontal Attachments

Re: Only two attachments in the latest news in large settings

Posted: 6. February 2024 22:19
by Jambore
Kirk wrote: 6. February 2024 17:06 It might be possible, but it would require many changes.

Would it be possible to implement Topic Image Preview on the portal homepage?

No images would be displayed, but attachments would be displayed when you HOVER on the title.

Topic Image Preview
https://www.phpbb.com/customise/db/exte ... e_preview/

Re: Only two attachments in the latest news in large settings

Posted: 7. February 2024 05:44
by Kirk
Ask the extensions author about it.

Re: Only two attachments in the latest news in large settings

Posted: 8. February 2024 18:50
by Jambore
Would it be possible to wrap attachments, photos in a spoiler using code on the portal homepage?

For example:

Simple Spoiler BBCode extension for phpBB

https://www.phpbb.com/customise/db/exte ... er_bbcode/

Or just edit the code for this option?

Re: Only two attachments in the latest news in large settings

Posted: 8. February 2024 19:07
by Kirk
Only on the portal is not possible. This needs to be included in the topics.

Re: Only two attachments in the latest news in large settings

Posted: 8. February 2024 20:40
by Jambore
Kirk wrote: 8. February 2024 19:07 Only on the portal is not possible. This needs to be included in the topics.

:arrow: Well, would it be possible to hard code it?

I just need to know the code. Where do I copy it?

Re: Only two attachments in the latest news in large settings

Posted: 9. February 2024 05:43
by Kirk
There might be a solution, but it needs to be tested first.

Re: Only two attachments in the latest news in large settings

Posted: 9. February 2024 17:07
by Kirk
Test this one:

Note: Does not work with inline attachment!

Open: root/ext/board3/portal/styles/prosilver/template/portal/modules/news_center.html
Find:

Code: Select all

					{% if news_row.S_HAS_ATTACHMENTS %}
						<dl class="attachbox">
							<dt>{{ lang('ATTACHMENTS') }}</dt>
							{% for attachment in news_row.attachment %}
								<dd>{{ attachment.DISPLAY_ATTACHMENT }}</dd>
							{% endfor %}
						</dl>
					{% endif %}
Replace with:

Code: Select all

					{% if news_row.S_HAS_ATTACHMENTS %}
						<details class="portal-attachment-spoiler">
							<summary class="portal-attachment-spoiler-text">
								{{ lang('ATTACHMENTS') }}
							</summary>
							<div class="portal-attachment">
								<dl class="attachbox">
									{% for attachment in news_row.attachment %}
										<dd>{{ attachment.DISPLAY_ATTACHMENT }}</dd>
									{% endfor %}
								</dl>
							</div>
						</details>
					{% endif %}
Open: root/ext/board3/portal/styles/prosilver/theme/portal.css
Insert at the end:

Code: Select all

/* Portal Attachment Spoiler */

details.portal-attachment-spoiler {
	background-color: #EDE8E0;
	border: 1px solid #CDC8C0;
	margin: 1em 0;
}

summary.portal-attachment-spoiler-text {
	display: list-item;
	cursor: pointer;
	font-size: 1.1em;
	padding: .5em;
}

.portal-attachment {
	border-top: 1px solid #CDC8C0;
	display: list-item;
	cursor: pointer;
	padding: .5em;
	list-style-type: none;
	font-size: 13px;
	cursor: default;
}

.portal-attachment .attachbox {
	float: none;
	width: max-content;
}
In the end "ACP -> General" --> purge cache It's recommended to purge your browser cache too.
You will have to make further changes or adjustments yourself.