Pagina 1 din 1

Variabila template

Scris: 24-Noi-2014, 14:45:21
de XDYNX
Am asta ...
myextension/event/listener.php

Cod: Selectaţi tot

<?php
/**

* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/

namespace phpbb\myextension\event;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Event listener
*/
class listener implements EventSubscriberInterface
{
	/** @var \phpbb\config\config */
	protected $config;

	/** @var \phpbb\config\db_text */
	protected $config_text;

	/** @var \phpbb\controller\helper */
	protected $controller_helper;

	/** @var \phpbb\request\request */
	protected $request;

	/** @var \phpbb\template\template */
	protected $template;

	/** @var \phpbb\user */
	protected $user;

	public function __construct(\phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\controller\helper $controller_helper, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user)
	{
		$this->config = $config;
		$this->config_text = $config_text;
		$this->controller_helper = $controller_helper;
		$this->request = $request;
		$this->template = $template;
		$this->user = $user;
	}

	/**
	* Assign functions defined in this class to event listeners in the core
	*
	* @return array
	* @static
	* @access public
	*/
	static public function getSubscribedEvents()
	{
	
		return array(
						
							'navbar_header_logged_out_content'	=> 'mycriptiframe',
						
							);
	}


	public function mycriptiframe($event)
	{
	
		$this->template->assign_vars(array(
			'TEST'	=> 'test',
		));
		
		
	}
	
		
}
si aici myextension\styles\all\template\event\navbar_header_logged_out_content.html

Cod: Selectaţi tot

{TEST}
Si nu merge nimic nu se intampla

Re: Variabila template

Scris: 15-Mar-2015, 11:22:08
de SSebastian
Mai exact, ce vrei tu sa faci?

Re: Variabila template

Scris: 15-Mar-2015, 22:17:01
de Florin Pavel
Event-ul pe care incerci sa-l apelezi este unul pentru template. Intra https://wiki.phpbb.com/Event_List la sectiune PHP Events.