Welcome
Guest
, you are in:
<root>
•
Login
devio dbscript ScrewTurn Wiki
Navigation
¶
Main Page
Random Page
Create a new Page
All Pages
Categories
Navigation Paths
Administration
File Management
Create Account
Search the wiki
»
Back
SnippetsAndTemplates
Modified on 2020/04/20 14:54
by
Administrator
Categorized as
Uncategorized
Source: http://screwturn.net/Help.SnippetsAndTemplates ''Snippets'' and ''templates'' are designed to help you create content without the need to repeat yourself. You can create, edit and delete snippets and templates in the administration panel, [AdminSnippets|Snippets/Templates] tab. {toc} ==Snippets== Snippets are pieces of text that can be used in all wiki content. The major advantage is that you can avoid to repeat commonly-used content in many places. Moreover, when you change the content of a snippet, the change is automatically propagated in all places where the snippet is used. There are basically three types of snippets, described below. ===Plain Snippets=== A ''plain'' snippets is just a piece of text. Let's assume you have create such type of snippet named ''Warning'' with the following content: @@'''Warning''': performing this action can cause harm to your computer.@@ You can invoke the snippet anywhere in your wiki using the following markup (case insensitive): @@{s:Warning}@@ When the page is rendered and the content displayed in the browser, the snippet is resolved and replaced with the following text: ((('''Warning''': performing this action can cause harm to your computer.))) ===Parameterized Snippets=== A ''parameterized'' snippet specifies parameters whose value can be set when invoking it. Expanding the example above, assume your snippet is defined like this: @@'''Warning''': performing this action can cause harm to your computer. For more details, see ?page_link? or alternatively contact ''?support_user?''.@@ You can invoke the snippet anywhere in your wiki using the following markup (case insensitive): @@{s:Warning | page_link = [++Help.MainPage|the help section] | support_user = John Smith }@@ The resulting output will be like this: ((('''Warning''': performing this action can cause harm to your computer. For more details, see [++Help.MainPage|the help section] or alternatively contact ''John Smith''.))) '''Note''': you can omit a parameter. In such case, its placeholder is removed from the output. ===Parameterized Snippets, Compact Style=== A ''compact parameterized'' snippet is similar to the one described above. For example, we can define a snippet like this (note that placeholders are numbers this time): @@'''Warning''': performing this action can cause harm to your computer. For more details contact ''?1?'' or ''?2?''.@@ You can invoke the snippet anywhere in your wiki using the following markup (case insensitive): @@{s:Warning|John Smith|Sally Doe}@@ The output will be like this: ((('''Warning''': performing this action can cause harm to your computer. For more details contact ''John Smith'' or ''Sally Doe''.))) In this case, parameters values cannot contain any complex markup such as links or images. '''Note''': you can omit a parameter, leaving it blank: @@{s:Warning||Sally Doe}@@ ===Nesting Snippets=== You can also invoke a snippet inside another snippet, for example (parameterized snippets are also supported): @@This is the content of a snippet, and it is possible to invoke a snippet from here: {s:OtherSnippet}@@ You can also use a snippet to set the value of a parameter of another snippet: @@{s:Warning | page_link = [++Help.MainPage|the help section] | support_user = {s:CurrentSupportUser} }@@ Or even: @@{s:MySnippet | my_parameter1 = {s:SomeOtherSnippet | other_parameter = [link] } | support_user = {s:CurrentSupportUser} }@@ ==Templates== Templates are pieces of text that can be used as starting points for pages. Let's assume you have created a template with the following content: @@'''Reporter''': user name '''Date''': report date '''Subject''': title ==Probelm Description== ===Additional Information=== @@ When you edit or create a page, you can use the template to initially populate the page content, as shown in this picture. [image:{UP}/HelpPictures/v1/Template.png|Template usage] Selecting the template in the drop-down list and clicking on the ''Use Template'' button, replaces the current page content (if any) with the template text. '''Note''': templates are '''not supported''' when using the Visual editor.
ScrewTurn Wiki
version 3.0.1.400. Some of the icons created by
FamFamFam
.