Author: dleinich
Publication Date: 6/18/2010 10:17
Sometimes a given output channel does not need to be generated or there is a need to prevent the generation of an output channel based on a various criteria in an if-statement. This can be achieved by using the following statement in the given output channel:
$CMS_SET(#global.stopGenerate, true)$
Using this statement the whole output channel will not be generated.
Tags: generation, knowledgebase
Kommentare
5 Kommentare
Attention:
If you do use $CMS_SET(stopGenerate,true)$, it is in your own responsibility to assure, that there are no active links to the appropriate page in the appropriate channel.
FirstSpirit will only check, if there is a valid link target (it is), but not, if the page is generated.
Example for a solution:
You use a Toggle Button “generate pdf” to stop the generation of the pdf channel:
<CMS_INPUT_TOGGLE name="generatePDF" preset="copy">
<LANGINFOS>
<LANGINFO lang="*" label="generatePDF?" description="deactivate to stop PDF generation of this page"/>
</LANGINFOS>
</CMS_INPUT_TOGGLE>
Within the generic Linktemplate you use a Pageref to link to the appropriate page
<CMS_INPUT_PAGEREF label="target"/>
Then before creating the link, just check if the toggle is set:
$CMS_IF(ref(ref).target.page.data.get("generatePDF"))$
Normal link to pdf channel here
$CMS_ELSE$
$CMS_IF(#global.preview)$<b>TARGET PAPGE HAS NO PDF OUTPUT, link will not be created$CMS_ELSE$ just text output here$CMS_END_IF$
$CMS_END_IF$
What happens on the file system? Does FirstSpirit generate an empty file ?
No, FirstSpirit does not generate anything. Even the folder structure will not be generate as long as there are no other files to be generated within the same structure :smileywink:
Hi Holger,
wie ist es denn wenn ich die Generierung einzelner Seiten über die Content-Projektion abbrechen möchte? Wr haben ein Feld "Freigabe" innerhalb von einem Datensatz, wenn dieses nicht auf aktiv gesetzt ist, soll die Generierung der einzelnen Seiten (bei denen das Flag nicht gesetzt ist) abgebrochen werden. Da es sich hierbei um eine Content-Projektion handelt, wurde das Grundgerüst (leere Seite) ja bereits generiert.
Verstehe ich das richtig, das stopGenerate bezieht sich immer auf den jeweiligen Absatz bzw. auf die Seitenvorlage? Muss ich das stopGenerate immer in der Seitenvorlage unterbringen?
Danke und Gruß
David
Hört sich für mich an, als könnte man diesen Anwendungsfall besser über eine Abfrage lösen. Also im Schema eine Abfrage erstellen, die nur Datensätze mit Haken bei "Freigabe" zurückgibt und diese Abfrage auf dem Daten-Reiter der Content-Projektion hinterlegen.
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.