Now that you are able to create basic MODx templates from watching the previous video, let's learn how to extend their functionality even further with the inclusion of reusable chunks of code and dynamic PHP snippets.
You only have to learn a couple new terms to understand what MODx is talking about — it’s not a steep learning curve, so jump in!
To clarify the process here, first you create a Chunk or a Snippet by logging into the MODx Manager and navigating to Resources->Manage Resources, then selecting the appropriate tab (for Snippet or for Chunk). You paste in the code you want to use, then save it. Back in your documents or templates, you can reference the Chunks and Snippets by name, flagging the names with either “{{ name }}” (for Chunks) or “[[ name ]]” (for Snippets). When MODx parses the document or template, the text in the Chunk will replace the tag, or in the case of a Snippet, the code will execute and its output will replace the tag.
You can also download MODx templates from a number of other sites! And since it’s so easy to integrate existing templates, you can download templates for virtually any platform and incorporate them into MODx.
After watching these two videos, I hope you can see how simple it is to get CMS functionality out of existing HTML/CSS using MODx. Again, the big thing I didn’t explicitly point out in the videos is that MODx stores its template code in its database: you can create and use a MODx template without uploading a single file to your webserver. Of course, if you want to reference CSS or Javascript files on your webserver, it’s accomplished in exactly the same way as you would do it on a static site: just make sure your paths to your resources are correct. I’ll cover how to write your own Snippets in another video. For now, just review the wiki page about MODx placeholders as you build your own templates. Please note, I did make one slip up in the video… Snippet values should usually include backticks, like this: [[MySnippet? ¶meter1=`value`]].
-- Everett Griffiths