This will explain all the conventions used in the Snippets.xlsx
- Each snippet is one one line / record
- Snippets records have
- set - a group they belong to, how they are grouped in the UI dropdown.
- subset - a sub-group, either for grouping in the UI, or to assign to something like
hyperlink-library
in the set @\InputType
.
- name - the name used in the UI
- title - not used
- content - the snipped using special placeholder conventions
- help - additional help-text shown if the snippet is inspected
- links - links to further documentation in a special format with the label
Tips when working with Excel
- when working with multi-line text, use Alt+Enter to get a line-break.
- when a field in excel starts with an "=" or "@" excel thinks it's a formula and complains. Prefix it with an apos ' to make it work, so use '= or '@
Special Syntax Conventions
Syntax Conventions in set
Snippets with prefixed with @ are for razor, [ are for token templates
Syntax Conventions in subset
This field usually has a grouping functionality, and will result in groups in the UI. An important exception is the @\InputType
and [\InputType
set, where the subset contains the name of the input type it's mapped to, like string-wysiwyg.
Syntax Conventions in content
Snippets often contain placeholders, so that inserting the snippet will let the user type in the placeholders. These placeholders have an ordering information (the order in which the user will replace them). The syntax is as follows:
${#:value}
marks a placeholder - the # is always a number, the value is always a text
${1:xxx}
means that this is the first fragment the user will overwrite, and that the default / initial text will be xxx
<${7:div}> bla bla </${7:div}>
- if you have two identical placeholders, they will be overwritten simultaneously
${#:var}
any initial name with var
is used for snippets like the InputType - the var will be replaced with the variable name, like "Content"
${#:prop}
any initial name with prop
is also used for InputType snippets, and will contain the property name, like "FirstName"
Syntax Conventions in links
Links are always in the syntax "label:link".
List of Snippet Sets
A snippet set (first column in excel) is shown as a group-name in the drop-down of the code editor. The names are standardized, and the label in the dropdown is retrieved from the translations. These are the sets and purpose:
- @App and [App
App snippets like the app-path, guid, etc. The UI will automatically also add all App-Resources and App-Settings to add
- @C#
core C# things like using statements, setting page-titles etc.
- @Content and [Content
common commands like toolbars in various use cases. This also include Presentation snippets. The UI will automatically add all fields and special snippets based on the input-types (see @\InputType below)
- @DnnRazor and [DnnToken
Access to common DNN objects like Module, ModuleID, Footer, Border etc.
- @Html and [Html
Various snippets for adding scripts / css etc.
- @Koi
CSS detection snippets and special snippets to auto-insert the right CSS classes based on the CSS framework used in the theme.
- @Linq
C# Snippets for using LINQ according to best practices. Make sure that they always point to the help-wiki about Linq
- @List and [List
Common repeaters to use in templates. The UI will only provide this option if it detects that a template is configured for lists.
- @User and [User
Snippets around the user properties and permissions
- @\InputType and [\InputType
Templates which are used in field-lists. So if a wysiwyg-field, hyperlink etc. is detected, the provided snippets will come from here.