Does Matrix support user defined keyword?


#1

Use case: we want to have a standard content in the email notifying user that someone has filled in a form. We don't want to include the form data in the email and instead of having to type the standard content in every form we created, I thought it would be nice to use keyword, but this must be user defined keyword. It would be even better if user defined keyword can consist of pre-defined keywords too.

 

I am not sure if that's supported. Could someone confirm that. Thank you.


(Bart Banda) #2

Hey, not sure what you exactly mean. But are you after snippets? https://matrix-manuals.squiz.net/system-configuration/chapters/global-preferences#Snippet-Content-Type-Preferences

 

Snippets allow you to basically create a library of content that can be accessed via a keyword called "Snippets". 

 

You could then easily just include the keyword in your forms and manage the content of that keyword outside of the form in a standard page that when updated, gets reflected on all other assets that use that snippet keyword. 


#3

Hi Bart, thank you for your response. I have tried your suggestion and have a question below. But let me explain what I am really after.

 

In the email that will be sent upon form submission, we can use keyword in the body of the email, for example %form_summary% - a list of responses received from this submission. And we can use various keywords in various other assets. My question was: does Matrix support a user defined keyword. So for example I can create a keyword called %my_custom_keyword% and use it in an asset (for example in the body of email to be sent after form was submitted) and Matrix will replace that keyword with a content that I have defined.

 

Your suggestion about Snippets is kind of what I need, except I can't see a way to insert that in the body of the email for form submission? Could you please explain more about

 

can be accessed via a keyword called "Snippets"

(Bart Banda) #4

Yep, Snippets are what you are after. So you can create a folder as the snippet root node (configure the root node in the global preferences) and then create standard pages under there.

 

Each content container that is created under those standard pages can be accessed via a snippet keyword, for example if your content container is ID 1234, the snippet keyword will then be %globals_snippet_12345%

 

You can even have custom text after the keyword to label it better, for example: %globals_snippet_12345_This_will_print_some_content%

 

Alternatively, you could just have a standard page and print the contents of it using the %globals_asset_contents_raw:1234% keyword where 1234 is the asset ID of your standard page. 


#5

Hi Bart, I have been able to use Snippet in the email body and it works.

 

Just further question, is it possible to include keywords in the body of snippet? For example, I was hopping the following would work:

A form submission has been received.

%form_info%

But apparently it doesn't.


(Bart Banda) #6

Hmm, I don't think so, never tried it, but I doubt so because the keywords inside the snippet are evaluated within the context of the snippet asset itself. So the snippet asset wouldn't know what the %form_info% keyword should print because it's not the custom form you are adding the snippet into. 


#7

Yeah fair enough. But at least I can do what I need to do. Thanks for your help Bart. Really appreciate that.