Page 1 of 1

Duplicate content blocks; template inheritance

Posted: Wed Apr 17, 2024 4:19 pm
by 10010110
So, I have a global page template that defines the default content in a block, like so:

Code: Select all

{block name="top"}
	…
	{content assign="main_content" label='Some text' scope="global"}
	…
{/block}
Then I have a child template that extends the default, replacing the default block content:

Code: Select all

{extends file='cms_template:Global'}

{block name="top"}
	{content assign="main_content" label='Some different text' scope="global"}
{/block}
I would assume it would just replace the default content block but it complains about duplicate blocks. What’s the deal? And how do I change the content label in different templates?

Re: Duplicate content blocks; template inheritance

Posted: Wed Apr 17, 2024 4:54 pm
by DIGI3
There can only be one default {content} tag in the hierarchy of templates, it's where cmsms does all its cmsms-y things. The easiest option is to move it further down in the hierarchy (so it's not even in the parent template).