tbabic
I'm new here

Limiting the number of template usages in green content area

Hello,



I would like to remove the possibility of adding the same template to content in green area in firstspirit cms more than once(see attached picture).



Currently, i can define "Standorte" and any other template more times, which is not so ideal for my case.



Is something like this possible?

Many thanks in advance


cmsLimit.png

2 Replies
hoebbel
Crownpeak employee

Hello tbabic,

This is not possible. But instead you can easily check within the templatecode if the section is already used within the same body and then for example output nothing (in the generation) or a corresponding hint in the preview.

Example code:

$CMS_SET(set_createOutput,true)$
$CMS_FOR(for_section,#global.section.parent.children(#global.section.class))$
	$CMS_IF(#global.section.template.uid == for_section.template.uid)$
		$CMS_SET(set_createOutput,false)$
		$CMS_SET(void, #for.BREAK)$
	$CMS_END_IF$
$CMS_END_FOR$
$CMS_IF(set_createOutput)$
$-- put the complete output of the section here --$

...

$CMS_ELSIF(!set_createOutput && #global.is("PREVIEW"))$
	<h3>You must not use this template more than once within a page</h3>
$CMS_END_IF$

Best regards
Holger

0 Kudos
sense
Elite Observer

Feel free to add a feature request for this.

0 Kudos