[TYPO3] Extension "comments" notification without the need to approve each comment?

Thomas Hirt info at thomas-hirt.at
Sat Oct 4 18:21:55 CEST 2008


If have just one more question ;)
The hook is allready working well.

I would like that people can define by typoscript in the setup of there 
page if the want to use there own template for the email.

For example
plugin.tx_comments_pi1 {
	tx_commentsemail_templateFile = fileadmin/path/to/email.txt
}

But if they don't set it is set with a default value.

I solved it like this and I don't think this is the right way doing it:

$templateCode = $pObj->conf['tx_commentsemail_templateFile'];
			if ($templateCode=="") {
				$templateCode = 
$pObj->cObj->fileResource('EXT:comments_email/res/email.txt');
			}else{
				$templateCode = $pObj->cObj->fileResource($templateCode);
			}

How could I do this better?
Is there a simple possibility to check:
	> if user setup is set
	> if the file exists
	> to include my path in a file called "ext_typoscript_setup.txt" (this 
file would then be the basic setup and values could be overwritten)

Greetings,
Thomas


Thomas Hirt schrieb:
> Hi, thank you anyway.
> I could solve the problem:
> 
> $subject = 
> $lang->sL('LLL:EXT:comments_email/pi1/locallang.xml:comments_email_subject_no_approval',1); 
> 
> 
> That works for me. I had to add "LLL:" and ",1" at the end of the line.
> 
> Looking forward to read your book.
> Great work,
> Thomas
> 
> 
> Dmitry Dulepov schrieb:
>> Hi!
>>
>> Thomas Hirt wrote:
>>> CODE
>>> $templateCode = $pObj->cObj->fileResource($conf['templateFile']);
>>> var_dump ($templateCode);
>>>
>>> RETURNS
>>> NULL
>>>
>>> So I think "$conf['templateFile']" is the problem.
>>> How can I fill my variable with the content of the file 
>>> "ext_typoscript_setup.txt" where I have the following code:
>>>
>>> plugin.tx_commentsemail_pi1.templateFile = 
>>> EXT:comments_email/res/email.txt
>>
>> $conf is for comments, not for your extension. You do not have a 
>> plugin, you have a hook. So add a new options to setup of the comments 
>> extension:
>>
>> plugin.tx_comments_pi1.tx_commentsemail_templateFile = 
>> EXT:comments_email/res/email.txt
>>
>> Now you can fetch it:
>> $templateCode = 
>> $pObj->cObj->fileResource($conf['tx_commentsemail_templateFile']);
>>
>>> Thanks for that code snippet. But I cannot get it to work.
>>> It return the string I put in...
>>
>> I can't check it now, no time, sorry :(
>>


More information about the TYPO3-english mailing list