[3.3][BETA] Topic Suffix Tags (helper ext)

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Anti-Spam Guide
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
Post Reply
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

[3.3][BETA] Topic Suffix Tags (helper ext)

Post by martti »

Extension Name: Topic Suffix Tags (helper ext)
Author: martti
Extension Description: This phpBB helper extension provides a PHP event for use by other extensions to set topic title suffix tags.
Extension Version: 0.5.0
Requirements:
  • phpBB 3.3+
  • PHP 7.1+
(For phpBB 3.2+ use version 0.3.0)
Extension Download: https://github.com/marttiphpbb/phpbb-ex ... master.zip The files are to be put in ext/marttiphpbb/topicsuffixtags
Github repository: https://github.com/marttiphpbb/phpbb-ex ... suffixtags
Languages: no language files included
Templates: prosilver
Screenshots:

These are the different locations the suffix will show up when calling the PHP event provided by this extension. The example here is just showing the id of the topic (not useful, but it is just an example) How to do this is described in the next post below in "For extension Developers: How to use in your extension".

Viewforum:

Image

Viewtopic:

Image

MCP viewforum

Image

MCP viewtopic

Image

Search topics

Image
Last edited by martti on Wed Apr 08, 2020 9:42 am, edited 8 times in total.
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Suffix Tags (helper ext)

Post by martti »

For extension Developers: How to use in your extension

The event triggered by this extension looks like this:

Code: Select all

		/**
		 * Event to set topic suffix tags 
		 *
		 * @event 
		 * @var	int 	topic_id			changing won't be fed back to calling event
		 * @var	array	topic_data			changing won't be fed back to calling event
		 * @var string  origin_event_name	name of the original event
		 * @var array	tags				push here your tags 
		 *
		 */
		$vars = ['topic_id', 'topic_data', 'origin_event_name', 'tags'];
		$result = $this->dispatcher->trigger_event('marttiphpbb.topicsuffixtags', compact($vars));
The sister extension, Topic Prefix Tags (helper ext), triggers a PHP event that works entirely the same way. You could add listeners for both extensions in your extension to provide your users (admins) flexibility so they can choose whether they want your data be displayed as a prefix or a suffix.

The example in the screenshots, just showing the topic id was implemented like this in the listener:

Code: Select all

	
	static public function getSubscribedEvents()
	{
		return [
			'marttiphpbb.topicsuffixtags'	=> 
				'marttiphpbb_topicsuffixtags',
		];
	}

	public function marttiphpbb_topicsuffixtags(event $event)
	{
		$tags = $event['tags'];
		$topic_id = $event['topic_id'];
		$tags[] = '[*' . $topic_id . '*]';
		$event['tags'] = $tags;
	}
The values pushed to the $tags array can be:
  1. a string, which will be rendered "raw", so you can include html tags if you like.
  2. an array itself, with keys include and var
In case of b:

include is a string of a template file to be included from your extension, so prefix it with @vendor_myextension/
var can be both a string or an array for providing variables to the included template. (var is the only variable available)

Example of a template:

Code: Select all

[ <a href="{{- var.url -}}"></a><i class="fa fa-pencil"></i> {{ lang('LANG_KEY', var.lang) -}}</a> ]
Last edited by martti on Fri Jul 27, 2018 3:28 pm, edited 1 time in total.
User avatar
eunaumtenhoid
Registered User
Posts: 998
Joined: Wed Jun 03, 2009 12:46 am
Location: ????

Re: [3.2][BETA] Topic Suffix Tags (helper ext)

Post by eunaumtenhoid »

is possible multiple suffix?? only text or img too??
My translations of the extensions for Brazilian Portuguese
https://github.com/phpBBTraducoes
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Suffix Tags (helper ext)

Post by martti »

eunaumtenhoid wrote:
Fri Jun 08, 2018 12:21 pm
is possible multiple suffix?? only text or img too??
You can put in multiple suffixes. And because it's a php event there's the advantage you can order them between extensions.
Because you can include your own templates, you can put in anything you like (img, text).
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Suffix Tags (helper ext)

Post by martti »

martti wrote:
Fri Jun 08, 2018 2:31 pm
eunaumtenhoid wrote:
Fri Jun 08, 2018 12:21 pm
is possible multiple suffix?? only text or img too??
You can put in multiple suffixes. And because it's a php event there's the advantage you can order them between extensions.
Because you can include your own templates, you can put in anything you like (img, text).
EDIT: You can also add <img> tags without including your own template.
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Suffix Tags (helper ext)

Post by martti »

Version 0.2.0 The PHP event got renamed from
marttiphpbb.topicsuffixtags.set_tags
to
marttiphpbb.topicsuffixtags
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.3][BETA] Topic Suffix Tags (helper ext)

Post by martti »

Hi, this extension got updated for phpBB 3.3+ with version 0.4.0

The requirements for version 0.4.0 are:
  • phpBB 3.3+
  • PHP 7.1+
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.3][BETA] Topic Suffix Tags (helper ext)

Post by martti »

Version 0.5.0 fixes an unset offset.
PT-NGS-
Registered User
Posts: 28
Joined: Sun Jun 12, 2005 1:12 pm

Re: [3.3][BETA] Topic Suffix Tags (helper ext)

Post by PT-NGS- »

Hello,

I can change the colors?
Image

Exemple

Earth [*15*]
Apple [*14*]
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.3][BETA] Topic Suffix Tags (helper ext)

Post by martti »

PT-NGS- wrote:
Fri May 01, 2020 6:36 am
Hello,

I can change the colors?
Image

Exemple

Earth [*15*]
Apple [*14*]
Yes, the inserted tags are "raw" html
User avatar
ac_roma
Registered User
Posts: 318
Joined: Thu Mar 08, 2007 2:48 pm
Location: egypt,alexandria
Contact:

Re: [3.3][BETA] Topic Suffix Tags (helper ext)

Post by ac_roma »

good and useful mod :idea:
Post Reply

Return to “Extensions in Development”