phpBB include Funktionen

In diesem Forum gibt es Starthilfe zum neuen Extension-System von phpBB 3.1/3.2. Fragen zur Entwicklung von Extensions und zur Konvertierung von phpBB 3.0.x MODs sind ebenfalls willkommen.
Antworten
Benutzeravatar
waldkatze
Ehemaliges Teammitglied
Beiträge: 792
Registriert: 08.03.2013 21:50

phpBB include Funktionen

Beitrag von waldkatze »

Ich möchte folgende phpBB-Funktionen in den Controller einer Extension einbinden.

includes/functions_content
includes/functions_user
includes/functions_display
includes/bbcode
includes/functions_messenger
includes/functions_posting

Das ist der Code im Controller:

Code: Alles auswählen

namespace waldkatze\tzv\controller;
use Symfony\Component\DependencyInjection\Container;

class main
{	
	protected $phpbb_container;
	protected $auth;
	protected $config;
	protected $db;
	protected $helper;
	protected $template;
	protected $user;
	protected $request;
	protected $pagination;
	protected $php_ext;
	protected $root_path;
  	protected $fetch_events; 

	public function __construct
	(
	    Container $phpbb_container,
	    \phpbb\auth\auth $auth,
	    \phpbb\config\config $config,
	    \phpbb\db\driver\driver_interface $db,			
	    \phpbb\controller\helper $helper,
	    \phpbb\request\request $request,
	    \phpbb\template\template $template,
	    \phpbb\user $user,
	    \phpbb\pagination $pagination,
	    $table_prefix,
	    $events,
	    $root_path,
	    $php_ext
	)
	{
		$this->auth          = $auth;
		$this->config       = $config;
		$this->db            = $db;
		$this->helper       = $helper;
		$this->request     = $request;
		$this->template   = $template;
		$this->user          = $user;
		$this->pagination = $pagination;	
		$this->root_path  = $root_path;
		$this->php_ext     = $php_ext;
		$this->events       = $events;
		
		$this->ext_root_path = $root_path . 'ext/waldkatze/tzv/';

                // TZV-Tabellen
		$this->table_prefix           = $table_prefix;
		$this->tourziel_table         = $phpbb_container->getParameter('tables.tourziel');
		$this->tourziel_cats_table    = $phpbb_container->getParameter('tables.tourziel_cats');
		$this->tourziel_country_table = $phpbb_container->getParameter('tables.tourziel_country');
		$this->tourziel_region_table  = $phpbb_container->getParameter('tables.tourziel_region');
		$this->tourziel_wlan_table    = $phpbb_container->getParameter('tables.tourziel_wlan');
		
		/*-------------------
	        Funktionen von phpBB 
	        -------------------*/
		include_once ($this->root_path . 'includes/functions_content.' . $this->php_ext);
		include_once ($this->root_path . 'includes/functions_user.' . $this->php_ext);
                include_once ($this->root_path . 'includes/functions_display.' . $this->php_ext);
                include_once ($this->root_path . 'includes/bbcode.' . $this->php_ext);
		include_once ($this->root_path . 'includes/functions_messenger.' . $this->php_ext);
		include_once ($this->root_path . 'includes/functions_posting.' . $this->php_ext);
}	
Debug-Meldung:

[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 73: include_once(phpincludes/functions_content.test_board_): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 73: include_once(): Failed opening 'phpincludes/functions_content.test_board_' for inclusion (include_path='.:/usr/lib/php7.3')
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 74: include_once(phpincludes/functions_user.test_board_): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 74: include_once(): Failed opening 'phpincludes/functions_user.test_board_' for inclusion (include_path='.:/usr/lib/php7.3')
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 75: include_once(phpincludes/functions_display.test_board_): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 75: include_once(): Failed opening 'phpincludes/functions_display.test_board_' for inclusion (include_path='.:/usr/lib/php7.3')
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 76: include_once(phpincludes/bbcode.test_board_): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 76: include_once(): Failed opening 'phpincludes/bbcode.test_board_' for inclusion (include_path='.:/usr/lib/php7.3')
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 77: include_once(phpincludes/functions_messenger.test_board_): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 77: include_once(): Failed opening 'phpincludes/functions_messenger.test_board_' for inclusion (include_path='.:/usr/lib/php7.3')
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 78: include_once(phpincludes/functions_posting.test_board_): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/ext/waldkatze/tzv/controller/main.php on line 78: include_once(): Failed opening 'phpincludes/functions_posting.test_board_' for inclusion (include_path='.:/usr/lib/php7.3')

Kann mir jemand helfen wo der Fehler liegt ?
Das Bremsen eines Motorrades ist die Verschwendung hochwertiger Geschwindigkeit in sinnlose Wärmeenergie.
Benutzeravatar
Kirk
Supporter
Supporter
Beiträge: 7878
Registriert: 24.05.2010 08:31
Kontaktdaten:

Re: phpBB include Funktionen

Beitrag von Kirk »

In der ersten Zeile fehlt das hier <?php (evtl. ein Kopierfehler) ganz am Ende der Datei fehlt eine Klammer }
Benutzeravatar
waldkatze
Ehemaliges Teammitglied
Beiträge: 792
Registriert: 08.03.2013 21:50

Re: phpBB include Funktionen

Beitrag von waldkatze »

@ Udo
Daran kann es nicht liegen.
Ich habe oben nur den relevanten Teil des Codes angezeigt. <?php habe ich drin. Die letzte Klammer auch.
Ich denke das Problem muss daran liegen das er den Pfad zu phpbb/includes nicht findet.
Alle anderen Funktionen der Extension Tabelleninhalt, Useranzeige, Pagination anzeigen usw. funktionieren.

Hier auch mal die services.yml dazu

Code: Alles auswählen

imports:
    - { resource: tables.yml }

services:
    waldkatze.tzv.controller.main:
        class: waldkatze\tzv\controller\main
        arguments:
            - '@service_container'
            - '@auth'
            - '@config'
            - '@dbal.conn'
            - '@controller.helper'
            - '@request'
            - '@template'
            - '@user'
            - '@pagination'
            - '@waldkatze.tzv.events'
            - '%core.root_path%'
            - '%core.php_ext%'
            - '%core.table_prefix%'
    waldkatze.tzv.events:
        class: waldkatze\tzv\model\events
        arguments:
            - '@service_container'
            - '@auth'
            - '@config'
            - '@dbal.conn'
            - '@user'
            - '%core.root_path%'
            - '%core.php_ext%'
            - '%core.table_prefix%'
    waldkatze.tzv.listener:
        class: waldkatze\tzv\event\main_listener
        arguments:
            - '@service_container'
            - '@auth'
            - '@dbal.conn'
            - '@config'
            - '@controller.helper'
            - '@request'
            - '@template'
            - '@path_helper'
            - '@user'
            - '%core.root_path%'
            - '%core.php_ext%'
            - '%core.table_prefix%'
        tags:
            - { name: event.listener }
Das Bremsen eines Motorrades ist die Verschwendung hochwertiger Geschwindigkeit in sinnlose Wärmeenergie.
Benutzeravatar
Dr.Death
Moderator
Moderator
Beiträge: 17401
Registriert: 23.04.2003 08:22
Wohnort: Xanten
Kontaktdaten:

Re: phpBB include Funktionen

Beitrag von Dr.Death »

Die Reihenfolge der Definitionen sind nicht korrekt.

Beispiel: die letzen 3 Zeilen:

Code: Alles auswählen

	protected $php_ext;
	protected $root_path;
  	protected $fetch_events; 
Im Construct:

Code: Alles auswählen

	    $events,
	    $root_path,
	    $php_ext

Code: Alles auswählen

		$this->root_path  = $root_path;
		$this->php_ext     = $php_ext;
		$this->events       = $events;
Bringe das überall in die korrekte Reihenfolge......

Beispiel:
https://github.com/DrDeath/phpbb-ext-f1 ... L49...L108

Am besten wäre es die Reihenfolge wie in den Services aufzubauen.
Benutzeravatar
waldkatze
Ehemaliges Teammitglied
Beiträge: 792
Registriert: 08.03.2013 21:50

Re: phpBB include Funktionen

Beitrag von waldkatze »

@ Doc du bist super !

Das war der entscheidende Tipp. Jetzt geht das :grin:
Vielen Dank.
Das Bremsen eines Motorrades ist die Verschwendung hochwertiger Geschwindigkeit in sinnlose Wärmeenergie.
Antworten

Zurück zu „Extension Bastelstube“