Cannot redeclare static block ‘title’

Notice: This thread is very old.
Ajax
Member | 59
+
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

David Matějka
Moderator | 6445
+
0
-

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

<h1 n:block=title>
{if $isMyProfile}
...
{else}
..
{/if}
</h1>
Aurielle
Member | 1281
+
+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>
Ajax
Member | 59
+
0
-

Great! Thanks! :)