Hi,
sorry this is probably a very simple question: how do i include a snippet into a template, but only for certain documents? do i have to create a new template?
many thanks,
Gareth
you can use in the top of the snippet this the numbers is the pages to allow snippet
if ($modx->documentIdentifier==2||$modx->documentIdentifier=3||....){
snippet_code
}
-
☆ A M B ☆
- 24,524 Posts
Or you could use a TV instead, and customize per page. You could even embed the snippet in a TV.
how do I embed a snippet in a tv?
-
☆ A M B ☆
- 24,524 Posts
Just have the snippet tags be the content of the TV; set the input type to be textarea. You can leave the default blank if you’re not going to use the snippet in most of your documents and add it in the field for documents where you want it, or if you are going to use it in most of the documents have the snippet tags be the default content and empty the field for documents where you don’t want it. Customize on a document-by-document basis. Or, have the default content just be @INHERIT if the snippet will be used in certain sections of the site, and set the content of the parent folder to be the snippet tags.
Think of it as an extra "content" section. Only more powerful.