Ja Nosch
Ja Nosch

Reputation: 423

typoscript find out if page to select from is hidden

I'm running a select from a static page (id 155 in my case). I only want this select to perform if the page itself is not hidden in the Backend. Is there a way to achieve this? I thought about using an sql clause in the "where" part but as far as i understand these clauses only affect content elements on the page but not the page (pidInList) itself...

   15 = CONTENT
   15 {
   wrap = <div id="xyz">|</div>
   table = tt_content
   select {
      pidInList = 155
      orderBy = sorting
      where = colPos=0
   }
}

Thanks!

Upvotes: 0

Views: 1210

Answers (2)

biesior
biesior

Reputation: 55798

Use subquery

where = colPos=0 AND (SELECT hidden FROM pages WHERE uid=tt_content.pid)=0

(it's fixed version of previous answer)

Note: cascaval's usage of stdWrap will allow you additionaly to hide the wrapping div if there's no records available, so with combination of all answers you have ready to use solution ;)

Upvotes: 1

tmt
tmt

Reputation: 8634

If you only want to avoid the wrap when the page is hidden and no content is to be displayed, use the required attribute:

15 = CONTENT
15 {
  stdWrap {
    required = 1
    wrap = <div id="xyz">|</div>
  }
  table = tt_content
  select {
    pidInList = 155
    orderBy = sorting
    where = colPos=0
  }
}

Upvotes: 1

Related Questions