MODx Evolution: Creating a Simple Custom Snippet Part 2 – Create the Snippet

Part 0: Introduction
Part 1: Write and Test the PHP Script

In the last installment of this brief series we went through the process of creating the raw PHP script that will form the basis of our snippet. We tested the code outside of MODx and it seemed to work pretty well. In this part, we’re going to start the process of transforming this script into a MODx snippet.  As I said before, I will be working on the Learn MODx website that we built during the MODx Beginner series of tutorials.  My goal is to use the snippet to add one or maybe two sections of MODx related feeds to the sidebar of the website.  But first, we need to create the snippet itself, so let’s get to work 🙂

Continue reading “MODx Evolution: Creating a Simple Custom Snippet Part 2 – Create the Snippet”

MODx Evolution: Creating a Simple Custom Snippet Part 1 – Write and Test the PHP Script

Part 0: Introduction

In the introductory post, I explained briefly what we’re going to create, made some important disclaimers, and blew some hot air around.  In this part, we’re going to get our hands dirty by diving in and writing the PHP script and testing it outside of MODx to make sure it works. In general, I think this is a good idea because it allows you to iron out any purely PHP issues in your code before dealing with the MODx side of things. Chances are that even after you’ve tested it and ported it into MODx, you’ll end up adding more PHP logic and stuff but if you can test most of it outside MODx first, it should potentially save you some headaches and debugging time when working inside MODx.  This is especially important because once inside the MODx editor there’s no syntax highlighting, automatic indenting and all that other good stuff.

With that in mind, let’s go ahead and create our script.

Continue reading “MODx Evolution: Creating a Simple Custom Snippet Part 1 – Write and Test the PHP Script”

MODx Evolution: Creating a Simple Custom Snippet Part 0 – Introduction

Welcome to this new series of tutorials on the MODx CMS where we’re going to be talking about creating custom snippets for MODx Evolution 1.0.x.  We’ve been building a website called Learn MODx and so far it’s just a simple but functional website.  We’re going to keep building on and enhancing this website.  Before we proceed, I should mention that I’ve already updated the Learn MODx website to the most recent version of MODx Evolution 1.0.2.  If you started at the beginning with me and still have your site running on 0.9.6.3, please take a moment to upgrade your site.  You can watch this screencast on how to upgrade your MODx site.

In this series on creating simple custom snippets, we’re going to look at the basics of creating your own snippets.  I’m no PHP guru so we’re not going to be doing anything crazy here 🙂 but I hope to give you enough information to jump start you into exploring and digging further to create bigger and better things and see how truly powerful and extensible MODx is.  At this point I assume you know what a snippet is and have probably already used some snippets in your own MODx websites.  (If you don’t know what a snippet is, please go over the MODx Beginner Series as that will help lay the foundation for this series).

Continue reading “MODx Evolution: Creating a Simple Custom Snippet Part 0 – Introduction”

From XHTML/CSS to MODx Template – Part 5

In the final part of this series, we’ll solve the little problem we ran into in the last screencast, and then proceed to finish off this part of our templating project. I hope that you’ve enjoyed this series and that you’ve learned something about working with MODx templates that will be useful to your own projects. I look forward to your feedback.

Useful Links:

MODx Beginner Tutorials

From XHTML/CSS to MODx Template – Part 4

In part 4, the focus of our work is on snippets, and we get our website navigation working using the Wayfinder snippet. We also start working with the Ditto snippet to pull in client testimonials. This is the longest screencast of the series at around 30 minutes. I was hoping to finish in this part but I run into a little hitch at the end, which I solve in the part 5.

Useful Links

MODx Beginner Tutorials –  Introducing Snippets
MODx Beginner Tutorials – Introducing Ditto
MODx Beginner Tutorials – More Ditto
Free Wayfinder ebook
Wayfinder Home Page
Ditto Home Page