[TYPO3-english] Conditionnal display of a content element (Stefan Reichelt)

Stefan Reichelt eichelt at web.de
Tue Mar 19 16:53:38 CET 2013


Hello,

On 19/03/2013 11:21, aliasjcdenton at sunrise.ch wrote:
> I there are subpages, always display the subpages section (a content
> element displaying links to subpages)

Sounds like a job for HMENU [1]. You could try what Edmund Huggett
wrote. Imho if such a menu should always be present anyway, displaying
the sibling-pages if no sub-pages are found is preferable to displaying
nothing at all (especially if your main navigation is a dropdown menu
[with several levels]).

> If the page is not empty, always display its contents (and after, the
> subpages section if there are subpages)

One idea would be to add both objects, the HMENU from above and the
RECORDS of your content elements into a COA [2] which you then can use
whichever way you want to use it. But this will ultimately depend on how
you render your content onto the page, ie. through TemplaVoila or Fluid
or such.

> If the page is empty and there are NO subpages, display a message
> mentionning that the page is in construction.

We already covered that in the previous post. Although since it wasn't
clear to me from your post, did it work with stdWrap.ifEmpty?

> If the page is empty and there are subpages, only display the subpages
> section (NO message mentionning that the page is in construction).

If it worked so far, then that might too:

source.stdWrap.ifEmpty = 587
source.stdWrap.ifEmpty.stdWrap.if.isFalse.numRows.table = pages

numRows [3] counts found entries. It also has a select [4] property
which by default has pidInList set to 'this'. Meaning we count all pages
which have the current page as parent and through the .if.isFalse, we
tell the ifEmpty to only be used if no sub-pages are found, which will
leave the source empty.
Or at least that's what I hope for anyway. :)
Although that might all be a little bit over complicated, there is
probably an easier way to it, oh well..
Anyway, I hope that makes sense so far?


Kind regards
Stefan

[1]
http://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Hmenu/Index.html
[2]
http://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/CoaAndCoaInt/Index.html
[3]
http://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Numrows/Index.html
[4]
http://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Select/Index.html


More information about the TYPO3-english mailing list