[TYPO3-english] Dynamic Database query using TypoScript

Peter Klein peter at umloud.dk
Mon Oct 13 20:11:17 CEST 2008


Hi Valter.
It's not possible using the "DB:table:uid:field" setup, but you can do it 
using a CONTENT element.

Something like this. (Untested, as I don't have the ext you are using 
installed)

-- cut --
lib.code = COA_INT
lib.code {
  10 = CONTENT
  10.table = tx_wecstaffdirectory_info
  10.select.pidInList = #Insert Id of page where you store your records
  10.select.andWhere.data = GPvar:tx_wecstaffdirectory_pi1|curstaff
  10.select.andWhere.wrap = uid=|
  10.renderObj = TEXT
#  10.renderObj.data = debug:data
  10.renderObj.field = position_title
  10.renderObj.wrap = Title = |<br>
  if.isTrue.data = GPvar:tx_wecstaffdirectory_pi1|curstaff
}
-- cut --

Using a CONTENT element, you have access to ALL fields of the selected 
record(s) in the renderObj
You can try commenting out the 10.renderObj.field = position_title line, and 
remove the comment on the line abowe. That will show you all the available 
fields.

--
Peter Klein

"Valter Rodrigues" <thesthunder at yahoo.com> wrote in message 
news:mailman.1.1223898581.8933.typo3-english at lists.netfielders.de...
> Hi!
>
> I 'm trying the following typoscript to make a db query:
>
> lib.code=TEXT
> lib.code.data=DB:tx_wecstaffdirectory_info:55:position_title
>
> Is there any way to replace the 55 with a dynamic value? For example
> lib.temp.data = GPvar:tx_wecstaffdirectory_pi1|curstaff
> and then replace the 55 with the lib.temp's value.
>
> Maybe is there any other way to retrieve fields from database using 
> dynamic values inside the queries?
>
> Thanks you,
> Panagiotis 




More information about the TYPO3-english mailing list