[TYPO3-mvc] Accessing Typoscript values from a fluid template
Alban Cousinié
lists at mind2machine.com
Mon Apr 18 17:00:31 CEST 2011
Hello everybody,
I've been searching the Internet and the typo3v4mvc archive and couldn't
find a reliable way to access a Typoscript config value from a fluid
template, and in the end from a viewHelper to exploit this information.
I only found this partial information which is so stripped of any external
context that it is very hard to figure how to exploit it :
> How to use Typoscript in my viewHelpers?
> plugin.my_plugin {
> settings {
> itemsPerPage = 20
> }
> }
fluid: {settings}
viewHelper: $this->templateVariableContainer->get('settings');
I think I have tested every possible combination with this information
without success.
What I want is to retrieve in a backend fluid template the value of
"module.tx_m2mhumanressources.persistence.storagePid" which is defined in 3
locations : in my setup, in my constants, and in my page TS setup (so I am
pretty much sure the info is available).
The following entries are defined :
plugin.tx_m2mhumanressources.persistence.storagePid = 879
module.tx_m2mhumanressources.persistence.storagePid = 879
In the fluid template, using the standard cObject ViewHelper
if I try :
<f:cObject
typoscriptObjectPath="module.tx_m2mhumanressources.persistence.storagePid"
/>
I get :
- Fatal error: Call to a member function setTSlogMessage() on a non-object
in
/home/vulcania/typo3_src-4.5.2/typo3/sysext/cms/tslib/class.tslib_content.ph
p on line 789
if I try :
<f:cObject
typoscriptObjectPath="tx_m2mhumanressources.persistence.storagePid" />
or :
<f:cObject typoscriptObjectPath="persistence.storagePid" />
I get the following messages inserted in the template :
- TypoScript object path "tx_m2mhumanressources.persistence.storagePid" does
not exist
- TypoScript object path "persistence.storagePid" does not exist
In my custom viewHelper called like this :
<m2m:be.buttons.newicon
tableName="tx_m2mhumanressources_domain_model_joboffer"
storagePid="{module.tx_m2mhumanressources.persistence.storagePid}"
title="new content" />
If I execute :
$settings = $this->templateVariableContainer->getAllIdentifiers();
I only get one object listed :
- 1 : jobOffers
This is an object of my Domains and it not related to Typoscript.
Does anyone have a real world example with context for retreiving the
Typoscript values to a fluid template ?
Then passing these to a ViewHelper shouldn't be too much a problem I guess.
If you have any example for this I'm a taker : I've already spent a whole
day trying to sort out this issue without success.
Thanks
Alban
More information about the TYPO3-project-typo3v4mvc
mailing list