Seite 1 von 1

problem mit emailer.php

Verfasst: 19.12.2004 15:26
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?

Verfasst: 20.12.2004 16:05
von Lord_Femto
schieb...

Verfasst: 20.12.2004 20:39
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.

Verfasst: 21.12.2004 22:40
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;
	}

Verfasst: 21.12.2004 23:41
von Blutgerinsel
Fehlereingrenzung das normale Template ärgert nicht?