[TYPO3-content-rendering] Plain Text mails with TemplaVoila FCEs
Franz Koch
typo.removeformessage at fx-graefix.de
Wed Apr 16 14:04:59 CEST 2008
Hey Mike,
I think you could use a trick for that:
1)
First - add a new renderType for TV templates:
---- PageTS ------
TCEFORM.tx_templavoila_tmplobj.rendertype.addItems {
plain = Plaintext
}
------------------
2)
then, create a plaintext-Template for your FCE, make it a subtemplate of
your HTML-template version and select the renderingType 'Plaintext' for
the template object.
3)
use some TS-conditions to force TV to use the plaintext template
--- TS setup -----
// check for the GetVar in the URL that you use for indicating the
// plaint text Newsletter. I configured direct_mail to use
// &newsletter=html and &newsletter=plain
[globalVar = GP:newsletter = html]
# include your HTML newsletter pageObject and do whatever you like
[global]
[globalVar = GP:newsletter = plain]
// setup tt_content for plaintext rendering
tt_content < lib.alt_plaintext.renderObj
// include FCE rendering again
tt_content.templavoila_pi1 =< plugin.tx_templavoila_pi1
// tell FCEs to use the plaintext subtemplate
tt_content.templavoila_pi1.childTemplate = plain
// same now for the page object itself
page {
headerData >
// some further configuration for your plaintext version
config {
#...
disableAllHeaderCode = 1
}
// assuming that TSobject 20 is your TemplaVoila instance
// tell TV to use the plaintext version of the page template
20.childTemplate = plain
}
[/global]
------------------
4)
Write a little function for rendering custom cTypes and register it in
direct_mail_pi1:
--- localconf ----
$TYPO3_CONF_VARS['EXTCONF']['direct_mail']['renderCType'][] =
'your_classname';
------------------
--- the class itself ---
class your_classname {
function renderPlainText(&$parent,&$content) {
$lines = array();
$CType = (string)$parent->cObj->data['CType'];
switch($CType) {
case 'templavoila_pi1':
$lines[] =
$parent->cObj->cObjGetSingle($parent->conf[$cType],$this->conf[$cType.'.']);
break;
}
return $lines;
}
}
------------------------
That should be all you need to do. It's untested - but should work. I
already use the TS-condition switch for the general rendering of
plainText-Newsletter - but without the FCE part, because I don't need
FCEs in newsletters. So there might be some typos or other tweaks needed
to get the FCE-stuff running - but it should work like described.
--
Kind regards,
Franz
More information about the TYPO3-project-content-rendering
mailing list