[Typo3] Get Flexform data with TypoScript
Kraft Bernhard
kraftb at gmx.net
Wed Jun 22 17:40:20 CEST 2005
Lars Houmark wrote:
> lib.mymenu = HMENU
> lib.mymenu.special = directory
> lib.mymenu.special.value = 65
> lib.mymenu.1 = TMENU
> lib.mymenu.1 {
> noBlur = 0
> expAll = 1
> wrap = <ul id="mymenu" class="mymenu"> | </ul>
> NO.wrapItemAndSub = <li> | </li>
> ACT = 1
> ACT.wrapItemAndSub = <li> | </li>
> }
Well ... with menus you have a problem. I just noticed that it also doesn't work
if you fetch pages with
lib.test = CONTENT
lib.test.table = pages
But I have a workaround for that. a postUserFunc which fetches the FlexForm value
from the array makes an xml2array and returns the respective field ...
But you will have to find out how you can access the currently rendered page.
I guess it's in $GLOBALS['TSFE']->currentRecord ...
Here's the postUserFunc I use to get a FlexForm value from tt_content elements and
pages retrieved via CONTENT:
class user_myclass {
function getContentFlexValue($content, $conf) {
list($table, $uid) = t3lib_div::trimExplode(':', $GLOBALS['TSFE']->currentRecord, 1);
$rec = $GLOBALS['TSFE']->sys_page->getRawRecord($table, $uid);
$flexXML = $rec['tx_templavoila_flex'];
$XML = t3lib_div::xml2array($flexXML);
return $XML['data']['sDEF']['lDEF'][$conf['field']]['vDEF'];
}
}
insert it like:
lib.test = TEXT
lib.test.postUserFunc = user_myclass->getContentFlexValue
lib.test.postUserFunc.field = field_whichXMLfieldIwantTOretrieve
greets,
Bernhard
--
Kraft Bernhard
MOKKA Medienagentur <http://www.mokka.at>
T: +43 - 1 - 895 33 33 - 50
More information about the TYPO3-english
mailing list