[Typo3] TV: separate print and text-only views

Dmitry Dulepov typo3 at fm-world.ru
Thu Aug 11 23:21:26 CEST 2005


Hi!

Well, you can try to add a new value to the TemplaVoila's TCA and see
what happens. Assuming you make a new extension, you can add to its tca.php:
$TCA['tx_templavoila_tmplobj']['columns']['rendertype']['config']['items'][]
= array('LLL:EXT:myext/locallang_db.php:new.rendertype.label',
'accessibility');

Then hacking of pi1 is required:
=================
// Initialize rendering type:
if ($this->conf['childTemplate'])	{
	$renderType = $this->conf['childTemplate'];
} else {	// Default:
	$renderType = t3lib_div::GPvar('print') ? 'print' : '';
}
=================
to
=================
// Initialize rendering type:
if ($this->conf['childTemplate'])	{
	$renderType = $this->conf['childTemplate'];
} else {	// Default:
	foreach
($TCA['tx_templavoila_tmplobj']['columns']['rendertype']['config']['items']
as $rtype) {
		if ($rtype[1] != '' && t3lib_div::GPvar($rtype[1]) != '') {
			$renderType = $rtype[1];
			break;
		}
	}
}
=================
This code will enable ANY render type defined in TCA (i.e. created by
user extension). As you see, it can get rendering type from
confgiuration as well, but this is not what you need actually...

This is what I could figure out quickly. Hope, this helps.

Dmitry.

Paul Vetch wrote:
> Hi there,
> 
> I have several sites up and running now in Typo 3.7 and 3.8 using TV, and 
> I've been using a subtemplate for the print version which works well.  But I 
> also want to be able to offer a 'text-only' version for accessibility 
> reasons (the difference will be that the text-only version will include 
> navigation, plus some cosmetic differences), and I want to achieve this 
> using another subtemplate (I know I could partially achieve this using 
> stylesheet switching, but a server side solution with templates is far more 
> elegant, flexible and reusable).
> 
> Question is: how can I set up TV to use an additional render type with a 
> parameter like 'textonly=1', say, to call another subtemplate?
> 
> It seems easy enough to hack the code to add more rendertypes, but the 
> 'print' type is evidently hardcoded into TV.
> 
> Has anyone done this?
> 
> Best
> 
> Paul Vetch
> 
> 



More information about the TYPO3-english mailing list