problem mit emailer.php

Fragen zu allen Themen rund ums Programmieren außerhalb von phpBB können hier gestellt werden - auch zu anderen Programmiersprachen oder Software wie Webservern und Editoren.
Antworten
Lord_Femto
Mitglied
Beiträge: 701
Registriert: 19.12.2003 15:53
Wohnort: Berlin

problem mit emailer.php

Beitrag von Lord_Femto »

hi. also ich habe ein problem mit dem email system von phpbb. ich übertrage ja schon das templatesystem auf meine homepage nun möchte ich auch die emailer klasse übernehmen. soweit so gut, doch stellt sich ein fehler heraus (s.u.)
ANMERKUNG: das languages-system von phpbb nutze ich nicht.

use_template function der emailer.php

Code: Alles auswählen

function use_template($template_file)
	{
		global $inu_root_path;

		if (trim($template_file) == '')
		{
			message_die(GENERAL_ERROR, 'No template file set', '', __LINE__, __FILE__);
		}

		if (empty($this->tpl_msg[$template_file]))
		{
			if (!@file_exists(@phpbb_realpath($tpl_file)))
			{
				$tpl_file = $inu_root_path . 'email/' . $template_file . '.tpl';

				if (!@file_exists(@phpbb_realpath($tpl_file)))
				{
					message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file, '', __LINE__, __FILE__);
				}
			}

			if (!($fd = @fopen($tpl_file, 'r')))
			{
				message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $tpl_file, '', __LINE__, __FILE__);
			}

			$this->tpl_msg[$template_file] = fread($fd, filesize($tpl_file));
			fclose($fd);
		}

		$this->msg = $this->tpl_msg[$template_file];

		return true;
	}
ausführung der news_send.php

Code: Alles auswählen

if ( !$error )
	{
		include($phpbb_root_path . 'includes/emailer.'.$phpEx);

		$emailer = new emailer(0);
	
		$emailer->from($page_config['page_email']);
		$emailer->replyto($page_config['page_email']);

		for ($i = 0; $i < count($bcc_list); $i++)
		{
			$emailer->bcc($bcc_list[$i]);
		}

		$email_headers = 'X-AntiAbuse: Board servername - ' . $page_config['server_name'] . "\n";
	
		$emailer->use_template('news_send_email');
		$emailer->email_address($page_config['page_email']);
		$emailer->set_subject($subject);
		$emailer->extra_headers($email_headers);

		$emailer->assign_vars(array(
			'SITENAME' => $page_config['page_name'], 
			'BOARD_EMAIL' => $page_config['page_email'], 
			'MESSAGE' => $message)
		);
		
		$emailer->send();
		$emailer->reset();

		message_die(GENERAL_MESSAGE, 'E-Mail wurde gesendet<br /><br />' . sprintf('Hier klicken, um zurück zu kehren',  '<a href="index.'.$phpEx.'?show=news_send">', '</a>'));
	}
email template im ordner: root/email/news_send_email.tpl

folgende fehlermeldung:
Template->make_filename(): Error - file does not exist
warum findet er die template-datei nicht, obwohl doch der pfad etc. richtig angegeben ist?
Gruß Lord_Femto
visit - http://www.pandemicbrew.de
Project X
Lord_Femto
Mitglied
Beiträge: 701
Registriert: 19.12.2003 15:53
Wohnort: Berlin

Beitrag von Lord_Femto »

schieb...
Gruß Lord_Femto
visit - http://www.pandemicbrew.de
Project X
Cojote
Mitglied
Beiträge: 40
Registriert: 14.10.2004 14:44

Beitrag von Cojote »

Versuch mal $tpl_file mit $this->tpl_file zu ersetzen, da du die Instanzvariable des Objekts setzen musst um das Templatefile für den EMailer zu setzen.
Lord_Femto
Mitglied
Beiträge: 701
Registriert: 19.12.2003 15:53
Wohnort: Berlin

Beitrag von Lord_Femto »

immer noch der gleiche fehler....

Code: Alles auswählen

	function use_template($template_file)
	{
		global $inu_root_path;

		if (trim($template_file) == '')
		{
			message_die(GENERAL_ERROR, 'No template file set', '', __LINE__, __FILE__);
		}

		if (empty($this->tpl_msg[$template_file]))
		{
			$this->tpl_file = $inu_root_path . 'email/' . $template_file . '.tpl';
		
			if (!@file_exists(@phpbb_realpath($this->tpl_file)))
			{
				$this->tpl_file = $inu_root_path . 'email/' . $template_file . '.tpl';

				if (!@file_exists(@phpbb_realpath($this->tpl_file)))
				{
					message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file, '', __LINE__, __FILE__);
				}
			}

			if (!($fd = @fopen($this->tpl_file, 'r')))
			{
				message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $tpl_file, '', __LINE__, __FILE__);
			}

			$this->tpl_msg[$template_file] = fread($fd, filesize($this->tpl_file));
			fclose($fd);
		}

		$this->msg = $this->tpl_msg[$template_file];

		return true;
	}
Gruß Lord_Femto
visit - http://www.pandemicbrew.de
Project X
Benutzeravatar
Blutgerinsel
Mitglied
Beiträge: 1801
Registriert: 19.07.2004 18:53
Wohnort: Landkreis Ulm
Kontaktdaten:

Beitrag von Blutgerinsel »

Fehlereingrenzung das normale Template ärgert nicht?
Antworten

Zurück zu „Coding & Technik“