O'Reilly logo

MODx Web Development by Antano Solar John

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Creating Snippets

So far, we have learned how to use snippets to get the required functionality for our site. What about when there are no snippets available to do what we want to do? We might have to create the snippet ourselves. Fortunately, unlike most other CMSs, MODx requires no—or very little—overhead to turn any regular PHP code into a snippet.

Note

This chapter requires you to have a basic knowledge of PHP. However, even if this is not the case, I recommend that you read this chapter, as it will help you to better understand snippets.

Learning to create a snippet

In this section, we will learn to create a snippet by using a simple 'Hello World' program in PHP. To test the output, we will create a resource with the following details: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required