Only two attachments in the latest news in large settings

Current Version: 2.3.0
Released: 2023-03-19
Forum rules
Before creating a new support thread, please take a look at the board3 Portal FAQ and use the search!
Many questions have already been answered.

Topic author
Jambore
Active Member
Posts: 6
Joined: 5. February 2024 20:24

Only two attachments in the latest news in large settings

Post by Jambore »

Hi,

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

Code: Select all

{% if 2 S_HAS_ATTACHMENTS %}
??
User avatar

Kirk
Dev
Posts: 1956
Joined: 27. July 2010 18:02
phpBB.de User: Kirk

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

Post by Kirk »

Where exactly should this be displayed?
Gruß Udo

Topic author
Jambore
Active Member
Posts: 6
Joined: 5. February 2024 20:24

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

Post by Jambore »

Hi,

I'm just asking how to edit the code?

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

Kirk
Dev
Posts: 1956
Joined: 27. July 2010 18:02
phpBB.de User: Kirk

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

Post by Kirk »

If you mean the Latest news modules, it is not possible. Either display all attachments in the post or nothing.
Gruß Udo

Topic author
Jambore
Active Member
Posts: 6
Joined: 5. February 2024 20:24

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

Post 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.
User avatar

Kirk
Dev
Posts: 1956
Joined: 27. July 2010 18:02
phpBB.de User: Kirk

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

Post by Kirk »

It might be possible, but it would require many changes.
For attachments side by side, look here: Horizontal Attachments
Gruß Udo

Topic author
Jambore
Active Member
Posts: 6
Joined: 5. February 2024 20:24

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

Post by Jambore »

Kirk wrote: 6. February 2024 18: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/
User avatar

Kirk
Dev
Posts: 1956
Joined: 27. July 2010 18:02
phpBB.de User: Kirk

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

Post by Kirk »

Ask the extensions author about it.
Gruß Udo

Topic author
Jambore
Active Member
Posts: 6
Joined: 5. February 2024 20:24

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

Post 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?
User avatar

Kirk
Dev
Posts: 1956
Joined: 27. July 2010 18:02
phpBB.de User: Kirk

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

Post by Kirk »

Only on the portal is not possible. This needs to be included in the topics.
Gruß Udo

Topic author
Jambore
Active Member
Posts: 6
Joined: 5. February 2024 20:24

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

Post by Jambore »

Kirk wrote: 8. February 2024 20: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?
User avatar

Kirk
Dev
Posts: 1956
Joined: 27. July 2010 18:02
phpBB.de User: Kirk

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

Post by Kirk »

There might be a solution, but it needs to be tested first.
Gruß Udo
User avatar

Kirk
Dev
Posts: 1956
Joined: 27. July 2010 18:02
phpBB.de User: Kirk

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

Post 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.
Gruß Udo

Return to “Board3 Portal 2.3.x - English Support”