Cannot redeclare static block ‘title’

Ajax
Member | 57
+
0
-

Hello!

I have simple latte template:

{if $isMyProfile}
    <h1 n:block=title>{_'Your profile'}</h1>
{else}
    <h1 n:block=title>{_'User profile'}</h1>
{/if}

Tracy says Cannot redeclare static block 'title'. Is there a solution for this situation?

Thanks
Ales

Aurielle
Member | 1283
+
+1
-

I think @DavidGrudl mentioned that block declarations are not affected by conditional statements. The correct solution would be something like this:

<h1 n:block="title">{if $isMyProfile}{_'Your profile'}{else}{_'User profile'}{/if}</h1>

Comments

Ajax:

Great! Thanks! :)

4 years ago
David Matějka
Moderator | 5701
+
0
-

Hi,
it is not possible to define blocks in the condition, use this instead:

<h1 n:block=title>
{if $isMyProfile}
...
{else}
..
{/if}
</h1>