[TYPO3-english] retrieve IDs of content items in FCE?

Erich Specht erich at erichspecht.com
Sun Nov 11 18:19:46 CET 2012


Thank you for the reply, Torsten.  The problem with that solution is that
each time a user copies a page with the FCE on it, I believe the copy will
have a new ID so the typoscript won't be looking at the new copy of the FCE.

Is there another way to access the IDs of content items within an FCE on a
page - perhaps by field name rather than ID of the FCE?

-----Original Message-----
From: typo3-english-bounces at lists.typo3.org
[mailto:typo3-english-bounces at lists.typo3.org] On Behalf Of Torsten Schrade
Sent: Saturday, November 10, 2012 4:10 PM
To: typo3-english at lists.typo3.org
Subject: Re: [TYPO3-english] retrieve IDs of content items in FCE?

Hi Erich,

> Is it possible via typoscript to retrieve the unique IDs of tt_news 
> records that are placed into an FCE?
> 
> For example, I have a Flexible Content Element that contains a field 
> of type Page Content Elements that allow the user to choose tt_news 
> records.  From typoscript on the main page, can I retrieve the ID of 
> the article that was selected in that field?

Yes, you can do that using the XPATH cObj. Check out the tutorial on how to
get values from a tt_content flexform:

http://typo3.org/extensions/repository/view/cobj_xpath
http://typo3.org/extension-manuals/cobj_xpath/1.1.1/view/1/4/#id547457

Its basically the same for FCEs since they also store their values in XML.
You may adapt the following snippet to your structure:

lib.xpath = XPATH
lib.xpath {
  source.data = DB : tt_content:###YOUR_FCE_ID###:tx_templavoila_flex
  return = string
  expression = //field[@index="###YOUR_FIELDNAME###"]/value
  resultObj {
    cObjNum = 1
    1.current = 1
  }
}

Have fun,
Torsten
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list