Show event within view_topic page only once [RESOLVED]

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
caiocald
Registered User
Posts: 47
Joined: Mon Feb 26, 2018 9:32 pm
Location: Brasil
Name: B!

Show event within view_topic page only once [RESOLVED]

Post by caiocald » Tue Jan 08, 2019 10:00 pm

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
Last edited by caiocald on Wed Jan 09, 2019 1:54 am, edited 3 times in total.

User avatar
mrgoldy
Jr. Extension Validator
Posts: 791
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: Show event within view_topic page only once

Post by mrgoldy » Wed Jan 09, 2019 12:43 am

template/event/viewtopic_panel_post_body_inner.html

Code: Select all

{% if postrow.S_FIRST_ROW %}
	{% include '@caiocald_extension/your_rating_tool.html' %}
{% endif
Formerly known as posey.
''Proud member of the Studio"

User avatar
caiocald
Registered User
Posts: 47
Joined: Mon Feb 26, 2018 9:32 pm
Location: Brasil
Name: B!

Re: Show event within view_topic page only once

Post by caiocald » Wed Jan 09, 2019 12:49 am

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!

User avatar
caiocald
Registered User
Posts: 47
Joined: Mon Feb 26, 2018 9:32 pm
Location: Brasil
Name: B!

Re: Show event within view_topic page only once

Post by caiocald » Wed Jan 09, 2019 1:19 am

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,

User avatar
3Di
Registered User
Posts: 13223
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Show event within view_topic page only once

Post by 3Di » Wed Jan 09, 2019 1:54 am

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.
:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: Flerex, Majestic-12 [Bot] and 16 guests