[TYPO3-english] Add ID to body tag depends on DB value

Stefano Kowalke blueduck at gmx.net
Thu Mar 15 11:38:25 CET 2012


Hey,

I need some help with the following topic.

I am using EXT:cag_relatedcontent [1], which allows you create custom
tags / categories and add them to pages and content.


Now I want add a body ID which depends on the category the page is in.

Page: Meals (Cat: food)
<body id="food">

Page: Wines (Cat: liquids)
<body id="liquids">


The ext uses a mm table to make the connection between the page and the
categories.

pages_tx_cagrelatedcontent_category_mm
uid_local   ID of the page
uid_foreign ID of the category


I need the content of uid_foreign in depend of the current page, so I
tried this:

temp.category = CONTENT
temp.category {
  table = tx_cagrelatedcontent_category
  select {
    selectFields = tx_cagrelatedcontent_category.uid
    join = pages_tx_cagrelatedcontent_category_mm
    where = tx_cagrelatedcontent_category.uid =
pages_tx_cagrelatedcontent_category_mm.uid_foreign
    andWhere = pages_tx_cagrelatedcontent_category_mm.uid_local = {page:uid}
    andWhere.insertData = 1
  }

  renderObj = COA
  renderObj {
    10 = TEXT
    10 {
      required = 1
      wrap = |
      field = uid
    }
  }
}

where the output is just "CONTENT".



Another approach was using

[globalVar = DB:pages_tx_cagrelatedcontent_category_mm:3188:uid_foreign = 0]
page.bodyTag = <body>
[global]

[globalVar = DB:pages_tx_cagrelatedcontent_category_mm:3188:uid_foreign = 1]
page.bodyTag = <body id="jur">
[global]

[globalVar = DB:pages_tx_cagrelatedcontent_category_mm:3188:uid_foreign = 2]
page.bodyTag = <body id="ppp">
[global]

[globalVar = DB:pages_tx_cagrelatedcontent_category_mm:3188:uid_foreign = 3]
page.bodyTag = <body id="prax">
[global]


But this works neither.

What did I wrong?


Stefano

[1]
http://typo3.org/documentation/document-library/extension-manuals/cag_relatedcontent/current/


More information about the TYPO3-english mailing list