[Extension Support] Personal Extension
Forum rules
In order the get any support, you will have to do following:
1. Use a describing title!
2. Describe your problem and what happened when the problem occured
3. Tell us what version of phpBB3 you are currently using.
If not your topic may be ignored or locked!
In order the get any support, you will have to do following:
1. Use a describing title!
2. Describe your problem and what happened when the problem occured
3. Tell us what version of phpBB3 you are currently using.
If not your topic may be ignored or locked!
- cisco007 Offline
- BBCoder VI
- Posts: 1,049
- Joined: 16 Mar 2010, 16:14
- Local time: 04 Sep 2025 15:57
- Last active: -
- Location: Don't really know!
[Extension Support] Personal Extension
I have just started back into phpbb, and i had an extension that only had template injections, and css injections. but i was wondering what file do i make or edit to have it inject my ext's language file? i tried using the skeleton extension maker, but as soon as i enable the extension and refresh my board goes blank so i deleted it and wanted to start again? @Stoker @Steve any help?
- SpIdErPiGgY Offline
- Donator
- Posts: 53
- Joined: 13 Dec 2024, 08:43
- Local time: 04 Sep 2025 21:57
- Last active: -
- Location: Erpe-Mere, Belgium
- Contact:
[Extension Support] Personal Extension
You need to add that in
Something like:
Complete example:
/event/listener.php
Something like:
Code: Select all
public function load_language_on_setup($event)
{
$lang_set_ext = $event['lang_set_ext'];
$lang_set_ext[] = array(
'ext_name' => 'solidjeuh/boardmagic',
'lang_set' => 'common',
);
$event['lang_set_ext'] = $lang_set_ext;
}
Code: Select all
namespace solidjeuh\boardmagic\event;
/**
* @ignore
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Event listener
*/
class listener implements EventSubscriberInterface
{
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\template\template */
protected $template;
/**
* Constructor
*
* @param \phpbb\config\config $config
* @param \phpbb\template\template $template
*
*/
public function __construct(\phpbb\config\config $config, \phpbb\template\template $template)
{
$this->config = $config;
$this->template = $template;
}
static public function getSubscribedEvents()
{
return array(
'core.user_setup' => 'load_language_on_setup',
'core.page_footer' => 'page_footer',
);
}
public function load_language_on_setup($event)
{
$lang_set_ext = $event['lang_set_ext'];
$lang_set_ext[] = array(
'ext_name' => 'solidjeuh/boardmagic',
'lang_set' => 'common',
);
$event['lang_set_ext'] = $lang_set_ext;
}
public function page_footer($event)
{
$start_date = @gmdate('Y', $this->config['board_startdate']);
$this->template->assign_vars(array(
'L_COPYRIGHT_YEAR' => $start_date,
));
}
}
- cisco007 Offline
- BBCoder VI
- Posts: 1,049
- Joined: 16 Mar 2010, 16:14
- Local time: 04 Sep 2025 15:57
- Last active: -
- Location: Don't really know!
[Extension Support] Personal Extension
i thought i had it like it that, but i will check it and see. i'll keep you posted.
- cisco007 Offline
- BBCoder VI
- Posts: 1,049
- Joined: 16 Mar 2010, 16:14
- Local time: 04 Sep 2025 15:57
- Last active: -
- Location: Don't really know!
[Extension Support] Personal Extension
nah, i must be doing something wrong on the config/services.yml or on the event/listerner.php files.
i've uninstalled, deleted data, cleared the cache. used STK to uninstall extension, then reactivate it. and i still get a blank board
i've uninstalled, deleted data, cleared the cache. used STK to uninstall extension, then reactivate it. and i still get a blank board
- Stoker Offline
- Site Admin
- Posts: 4,555
- Joined: 12 May 2008, 21:26
- Local time: 04 Sep 2025 21:57
- Last active: -
- Favourite EXT: Forum Goal
- Location: Denmark
- Contact:
[Extension Support] Personal Extension
What does your services look like?
~ The greatest achievement in life is to inspire ~
Regards Stoker
Regards Stoker
- cisco007 Offline
- BBCoder VI
- Posts: 1,049
- Joined: 16 Mar 2010, 16:14
- Local time: 04 Sep 2025 15:57
- Last active: -
- Location: Don't really know!
[Extension Support] Personal Extension
Code: Select all
services:
cisco.myaddons.listener:
class: cisco\myaddons\event\listener
arguments:
- '@config'
- '@template'
tags:
- { name: event.listener }
Code: Select all
<?php
/**
*
* myaddons. An extension for the phpBB Forum Software package.
*
* @copyright (c) 2025, cisco, http://phpbbmexico.com
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace cisco\myaddons\event;
/**
* @ignore
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Event listener
*/
class listener implements EventSubscriberInterface
{
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\template\template */
protected $template;
/**
* Constructor
*
* @param \phpbb\config\config $config
* @param \phpbb\template\template $template
*
*/
public function __construct(\phpbb\config\config $config, \phpbb\template\template $template)
{
$this->config = $config;
$this->template = $template;
}
static public function getSubscribedEvents()
{
return array(
'core.user_setup' => 'load_language_on_setup',
'core.page_footer' => 'page_footer',
);
}
public function load_language_on_setup($event)
{
$lang_set_ext = $event['lang_set_ext'];
$lang_set_ext[] = array(
'ext_name' => 'cisco/myaddons',
'lang_set' => 'common',
);
$event['lang_set_ext'] = $lang_set_ext;
}
public function page_footer($event)
{
$start_date = @gmdate('Y', $this->config['board_startdate']);
$this->template->assign_vars(array(
'L_COPYRIGHT_YEAR' => $start_date,
));
}
}
- Stoker Offline
- Site Admin
- Posts: 4,555
- Joined: 12 May 2008, 21:26
- Local time: 04 Sep 2025 21:57
- Last active: -
- Favourite EXT: Forum Goal
- Location: Denmark
- Contact:
[Extension Support] Personal Extension
and you do have a lang file called common in cisco\myaddons\language\en (or es or both)?
~ The greatest achievement in life is to inspire ~
Regards Stoker
Regards Stoker
- cisco007 Offline
- BBCoder VI
- Posts: 1,049
- Joined: 16 Mar 2010, 16:14
- Local time: 04 Sep 2025 15:57
- Last active: -
- Location: Don't really know!
[Extension Support] Personal Extension
yeah, something is wrong there i can't get it. if i remove the services.yml file it works, but i can't get the language variables needed.
To much reading here:
https://area51.phpbb.com/docs/dev/3.2.x ... vents.html
To much reading here:
https://area51.phpbb.com/docs/dev/3.2.x ... vents.html
- Stoker Offline
- Site Admin
- Posts: 4,555
- Joined: 12 May 2008, 21:26
- Local time: 04 Sep 2025 21:57
- Last active: -
- Favourite EXT: Forum Goal
- Location: Denmark
- Contact:
[Extension Support] Personal Extension
Take a look at this version:
You can compare it to your own and see what went wrong
Its testet and working with lang file.You can compare it to your own and see what went wrong
~ The greatest achievement in life is to inspire ~
Regards Stoker
Regards Stoker
- cisco007 Offline
- BBCoder VI
- Posts: 1,049
- Joined: 16 Mar 2010, 16:14
- Local time: 04 Sep 2025 15:57
- Last active: -
- Location: Don't really know!
[Extension Support] Personal Extension
i just looked at my language file for some reason it had a [ instead of a (
and when i open your lang file notepad++ says yours is unix/ansi and mine is unix/utf8. isn't that what its supposed to be?
and when i open your lang file notepad++ says yours is unix/ansi and mine is unix/utf8. isn't that what its supposed to be?