[TYPO3-english] Check if an area doesn't contain elements

Jeppe Donslund jeppe at donslund.net
Thu Dec 17 11:24:41 CET 2009


Hi

This:

lib.element1 = COA
lib.element1 {
    10 = RECORDS
    10.dontcheckPid = 1
    10.tables = tt_content
    10.source = 47
}


lib.btm_elm_1 = COA
lib.btm_elm_1 {
     10 = RECORDS
     10 {
         source.current = 1
         tables = tt_content
         stdWrap {
             ifEmpty.cObject < lib.element1
         }
     }
     stdWrap {
         required = 1
         wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
     }
}

This does show if there are content, but if there are no content the 
area is empty. It does not show element uid 47.

Jeppe




JoH asenau skrev:
>>> Does it work? Otherwise you are at least getting VERY close.
>>>
>>> Jeppe Donslund schrieb:
>>>> Hi Loek.
>>> [...]
>>>>         <eType_EXTRA type="array">
>>>>             <objPath>lib.btm_elm_1</objPath>
>>>>         </eType_EXTRA>
>>>    [SNIP]
>>>
>>> In general you either define a "local" TypoSript-Setup INSIDE the
>>> datastructure OR you "reference" an objPath, which then is setup
>>> inside a regular TypoScript template(NOT within the datastructure).
>>>
>>> So if it does not work move the lines 'lib.btm_elm_1=COA' with
>>> corresponding setup to the template where you define lib.element1.
>>> Since you copy  lib.element1 inside lib.btm_elm_1 you have to insert
>>> it AFTER lib.element1.
>> If it should not be an Objectpath Lib.btm_elm_1. What should it the
>> be? btm_elm_1 should contain regular TYPO3 element, but if it
>> doesn't. It should contain the element with uid 49.
> 
> Peter told you to just define the path. The definition of this path then has
> to be made in a separate TypoScript template:
> 
> Only this will stay in your TV structure:
> 
> <eType_EXTRA type="array">
>     <objPath>lib.btm_elm_1</objPath>
> </eType_EXTRA>
> 
> And this should be the "external" TypoScript defined in the SETUP part of a
> TypoScript template:
> 
> lib.btm_elm_1 = COA
> lib.btm_elm_1 {
>     10 = RECORDS
>     10 {
>         source.current = 1
>         tables = tt_content
>         stdWrap {
>             ifEmpty.cObject < lib.element1
>         }
>     }
>     stdWrap {
>         required = 1
>         wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
>     }
> }
> 
> "current = 1" will fill in the CSV list of content element IDs if any.
> This will switch "stdWrap.ifEmpty" to true if there aren't any values in the
> list.
> Then lib.element1 will be used instead.
> Both will be wrapped wit the comment for TYPO3SEARCH.
> This will be stripped if there is no content at all.
> 
> @Tapio: As long as you stay on the same page with your checks, most of the
> TypoScript stuff will be working as expected even with TV, since "current"
> contains the necessary information.
> 
> HTH
> 
> Joey
> 
> --
> Wenn man keine Ahnung hat: Einfach mal Fresse halten!
> (If you have no clues: simply shut your gob sometimes!)
> Dieter Nuhr, German comedian
> Xing: http://contact.cybercraft.de
> Twitter: http://twitter.com/bunnyfield
> TYPO3 cookbook (2nd edition): http://www.typo3experts.com
> 
> 


More information about the TYPO3-english mailing list