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

Dmitry Dulepov dmitry at typo3.org
Sat Oct 4 19:31:08 CEST 2008


Hi!

Thomas Hirt wrote:
> 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?

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

> Is there a simple possibility to check:
>     > if user setup is set

isset($pObj->conf['tx_commentsemail_templateFile'])

>     > if the file exists

fileResource will return you empty string if there is no file.

>     > 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)

This file is not recommended because it always incldes TS into every web site. This increases TS size and makes site slower.

-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/post-details/duplicate_content_with_realurl/


More information about the TYPO3-english mailing list