Part Four - Development

Ways To Make Your Snippets Better

Snippet Tips and Tricks

The MODX documentation has some excellent suggestions for making good snippets, but there are a number of good ideas that it doesn't mention. This section will highlight some of these ideas.

Preparation is Important

Writing your snippets so that their code is easy to understand and expand on or modify is just as important to the MODX ecosystem as is performing a given function. And this as much for the benefit of the snippet creator as it is for everyone else, after six months will you remember exactly how your snippet works or why you chose to use a certain method over another?

Another consideration is making it easy for the snippets to be used, in code, in MODX snippet tags, and even as output modifiers. Thought needs to be given on how the snippet's output can be structured and styled. Following the MODX documentation's recommendations will go a long way towards making your snippets consistant and understandable, and these recipes will give your snippets that extra elegant touch that indicates a master chef.

Susan Ottwell
February 2021