Check if pid of current page is X

Black picture Black · Oct 17, 2016 · Viewed 11.8k times · Source

How can I check if a page has a specific ID, and if true output a text?

I thought about something like this (pseudocode):

<f:if condition="{current.page.uid}=='78'">
    <p>I am Page 78</p>
</f:if>

Answer

Ren&#233; Pflamm picture René Pflamm · Oct 17, 2016

If you want to use this in an FLUIDTEMPLATE (page.10 = FLUIDTEMPLATE as example) you can access the page data with {data.uid}.

<f:if condition="{data.uid} == 78">
  <p>I am Page 78</p>
</f:if>

In an extbase Extension you can make it like @dimitri-l says.