[TYPO3-ect] Loading a extension based on lib/div from TS
R. van Twisk
typo3 at rvt.dds.nl
Mon Mar 5 15:03:44 CET 2007
Hey Guys,
Instead of showing my extension using page -> add plugin I needed the
load it from typoscript.
I often load and configure extensions from TS because it allows me to
have a easy way of adding
something to a page branch.
This is what I did:
plugin.tx_absgalleries.configurations {
exhibition_latest {
template = exhibition_latest_mini
}
}
tv.rightcolumn.30 < plugin.tx_absgalleries.controllerSwitch
tv.rightcolumn.30.controller = exhibition_latest
It needs to show the latest items on a exhibitions on the right column
of the page
in this page and all pages below.
Of course I wanted to load everything through controllerSwitch,
much like how it works when you added it to a page.
However I did notice that controllerSwitch only looks
at the flexform value, so I don't have any means from TS to tell
controller switch what to do.
So I modified the function to this version:
function main($content, $conf){
$sheetName = $conf['flexFormSheetName'] ?
$conf['flexFormSheetName'] : $this->flexFormSheetName;
$fieldName = $conf['flexFormFieldName'] ?
$conf['flexFormFieldName'] : $this->flexFormFieldName;
if ($conf[$fieldName]) {
$key = $conf[$fieldName];
} else { $this->_initFlexForm('pi_flexform');
$key =
$this->_getFlexFormValue($this->cObj->data['pi_flexform'], $fieldName,
$sheetName);
}
$return = $this->cObj->cObjGetSingle($conf[$key], $conf[$key.'.']);
$return = $this->cObj->stdWrap($return,$conf[$key.'.']['stdWrap.']);
return $return;
}
If the above finds a key in $conf, then we use that to load the
appropriate 'plugin'.
My basic questions are :
1) Is my way of adding the plugins with TS to correct method?
2) If so, would the above code be appropriate to handle these situations?
Thanks,
Ries
More information about the TYPO3-team-extension-coordination
mailing list