[Typo3-dev] Field, templavoila and typoscript

Kraft Bernhard kraftb at gmx.net
Wed Jun 15 15:20:46 CEST 2005


Patrick Boisclair wrote:
> Hi, I need help.
> 
> I create a FCE and it include two fields (field_title and field_content) and I need help to take the value of the field to use it with Typoscript object (lib.putText).
> 
> I check on Internet and I test a lot of configuration but not work.
> I read in TSRef in page 8, 
> - Gets value of the user defined fied in the root line required additional config in TYPO3_CONF_VARS to include field.

I also needed to use the value of a Flexform field of a FCE Content Element in TS.

In fact I uploaded a file into a FCE and wanted the link to the file to appear in two places in the FCE.
I did that by mapping the "href" attribute of both file-links to a TypoScript Object and then created
the follwing TS for the two links:

lib.pr_link1 = COA
lib.pr_link1 {
   10 = TEXT
   10.value = uploads/tx_templavoila/
   20 = TEXT
   20.postUserFunc = user_jones->getContentFlexValue
   20.postUserFunc.field = field_file
}

lib.pr_link2 < lib.pr_link1

The method "user_jones->getContentFlexValue" retrieves the value of a single field from the templavoila Flexform
of the actually rendered content element ...

The source-code of the getContentFlexValue method looks like this:
---------------snip--------------------
    function getContentFlexValue($content, $conf)   {
       list($table, $uid) = t3lib_div::trimExplode(':', $GLOBALS['TSFE']->currentRecord, 1);
       if ($table=='tt_content')  {
          $rec = $GLOBALS['TSFE']->sys_page->($table, $uid);
          $flexXML = $rec['tx_templavoila_flex'];
          $XML = t3lib_div::xml2array($flexXML);
          return $XML['data']['sDEF']['lDEF'][$conf['field']]['vDEF'];
       }
    }
---------------snip--------------------


I also coded a user-function to retrieve value from the Page-Flexform to notice afterwards that this already works by
default by using the ".field =" stdWrap property ...

So pherhaps this is already possible in some simpler way ... just don't know.



greets,
Bernhard
-- 
Kraft Bernhard
MOKKA Medienagentur <http://www.mokka.at>
T: +43 - 1 - 895 33 33 - 50




More information about the TYPO3-dev mailing list