Neuer Portalblock: Board3 Portal 2.1.0
Posted: 10. July 2021 10:38
Hallo,
phpBB: 3.3.4
PHP: 7.3.29
Board3 Portal 2.1.0
ich versuche, einen neues Portalmodul exakt nach dieser Anleitung zu erstellen: [How To] Create a module for Board3 Portal 2.1.x
Zuerst bekam ich eine Fehlermeldung wegen der fehlenden Anführungszeichen in der
Jetzt erhalte ich einen anderen Error, wenn ich die Extension aktivieren möchte:
Das ist der Inhalt meiner
phpBB: 3.3.4
PHP: 7.3.29
Board3 Portal 2.1.0
ich versuche, einen neues Portalmodul exakt nach dieser Anleitung zu erstellen: [How To] Create a module for Board3 Portal 2.1.x
Zuerst bekam ich eine Fehlermeldung wegen der fehlenden Anführungszeichen in der
root/ext/marc/b3pweather/config/services.yml
:
Code: Select all
services:
marc.b3pweather.weather:
class: marc\b3pweather\weather
arguments:
- '@config'
- '@template'
tags:
- { name: board3.portal.module }
Code: Select all
AH01071: Got error 'PHP message: PHP Parse error: syntax error, unexpected '{' in /var/www/vhosts/my-domain.com/httpdocs/_dev-circula/ext/marc/b3pweather/weather.php on line 16', referer: https://dev.my-domain.com/adm/index.php?i=acp_extensions&sid=78b54ce5bd14433c58a1165d16f0e43a&mode=main&action=enable&ext_name=marc%2Fb3pweather&hash=9e904b5c
root/ext/marc/b3pweather/weather.php
Code: Select all
<?php
/**
*
* @package Board3 Portal Weather Module
* @copyright (c) 2015 Marc Alexander ( www.m-a-styles.de )
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace marc\b3pweather;
/**
* @package Weather Module
*/
class weather extends \board3\portal\modules\module_base
{
/**
* Allowed columns: Just sum up your options (Exp: left + right = 10)
* top 1
* left 2
* center 4
* right 8
* bottom 16
*/
public $columns = 10;
/**
* Default modulename
*/
public $name = 'MARC_B3P_WEATHER';
/**
* Default module-image:
* file must be in "{T_THEME_PATH}/images/portal/"
*/
public $image_src = '';
/**
* module-language file
* file must be in "language/{$user->lang}/mods/portal/"
*/
public $language = array(
'vendor' => 'marc/b3pweather',
'file' => 'weather',
);
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\template\template */
protected $template;
/**
* Constructor for clock module
*
* @param \phpbb\config\config $config phpBB config
* @param \phpbb\template\template $template phpBB template
*/
public function __construct($config, $template)
{
$this->config = $config;
$this->template = $template;
}
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
$this->template->assign_vars(array(
'MARC_B3P_WEATHER_PLZ' => $this->config['marc_b3p_weather_plz_' . $module_id],
'MARC_B3P_WEATHER_COUNTRY' => $this->config['marc_b3p_weather_country_' . $module_id],
));
return '@marc_b3pweather/marc_b3p_weather_side.html';
}
/**
* {@inheritdoc}
*/
public function get_template_acp($module_id)
{
return array(
'title' => 'MARC_B3P_WEATHER',
'vars' => array(
'legend1' => 'MARC_B3P_WEATHER_SETTINGS',
'marc_b3p_weather_plz_' . $module_id => array('lang' => 'MARC_B3P_WEATHER_PLZ', 'validate' => 'string', 'type' => 'text:5:5', 'explain' => true),
'marc_b3p_weather_country_' . $module_id => array('lang' => 'MARC_B3P_WEATHER_COUNTRY', 'validate' => 'string', 'type' => 'text:3:3', 'explain' => true),
),
);
}
/**
* {@inheritdoc}
*/
public function install($module_id)
{
$this->config->set('marc_b3p_weather_plz_' . $module_id, '80331');
$this->config->set('marc_b3p_weather_country_' . $module_id, 'DE');
return true;
}
/**
* {@inheritdoc}
*/
public function uninstall($module_id, $db)
{
$this->config->delete('marc_b3p_weather_plz_' . $module_id);
$this->config->delete('marc_b3p_weather_country_' . $module_id);
return true;
}
}