Page 1 of 1

Show event within view_topic page only once [RESOLVED]

Posted: Tue Jan 08, 2019 10:00 pm
by caiocald
After completing my extension not long ago, I noticed that there is a detail in the operation that I do not know how to fix.

As some already know, my extension works as a scoring tool, located at the end of the first post of each topic.

Would you like to know how I can display it only once, blocked its repetition (as shown in the attached image)?

The only thing I could think of was this, but it does not work

Code: Select all

<!-- IF S_FIRST_POST -->
	  <!-- EVENT viewtopic_panel_post_body_inner -->
	  <!-- ENDIF-->
It's possible? Does anyone have a hunch, extension example, or keyword so I can search?

Thank you!
Capturar.jpg

Re: Show event within view_topic page only once

Posted: Wed Jan 09, 2019 12:43 am
by mrgoldy
template/event/viewtopic_panel_post_body_inner.html

Code: Select all

{% if postrow.S_FIRST_ROW %}
	{% include '@caiocald_extension/your_rating_tool.html' %}
{% endif

Re: Show event within view_topic page only once

Posted: Wed Jan 09, 2019 12:49 am
by caiocald
I was hesitant to update the topic as resolved when I saw your message.

Yes, I had forgotten to add the

Code: Select all

postrow.
before.

Anyway, thanks for the help!

Re: Show event within view_topic page only once

Posted: Wed Jan 09, 2019 1:19 am
by caiocald
I do not know what is happening.

But this code only works on my localhost (xampp).
My online server does not work. It's possible?

Code: Select all

<!-- IF FORUM_ID eq '5' and postrow.S_FIRST_POST -->
<!-- INCLUDE @red1000_pontuacao/viewtopic_panel_post_body_inner.html -->
<!-- ENDIF-->
EDIT1:

I discovered the error.
It seems to me that the "S_FIRST_POST" function only comes in the latest versions, and the phpbb version of my server is 3.2.1.

I had to manually add the line in my view_topic.php file

Code: Select all

'S_FIRST_POST'		=> ($topic_data['topic_first_post_id'] == $row['post_id']) ? true : false,

Re: Show event within view_topic page only once

Posted: Wed Jan 09, 2019 1:54 am
by 3Di
postrow.S_FIRST_POST is available since 3.2.3.

postrow.S_FIRST_ROW is the first row of a page of the same topic.
caiocald wrote:
Tue Jan 08, 2019 10:00 pm

Code: Select all

<!-- EVENT viewtopic_panel_post_body_inner -->
Is not a valid template event, it simply does not exist at https://wiki.phpbb.com/Event_List#Template_Events
which leads me to think that's more custom coding than an extension.