Blake Walters talked on “Practical Tips For Writing Custom Plugins”this morning at EECI.
He started off the presentation with this great quote:
EECI Helped Changed How I Build Sites.
I remember EECI in Brooklyn last year, where Matt Weinberg, Rob Sanchez, and many others highly emphasized jumping into the source code, and getting into add-on development.
This year Blake helps those who’ve never written add-ons, and those with little experience in add-on development, learn the very basics of getting started.
Compared to last EECI, Blake’s process for how he built sites changed:
- New development workflow
- Always up-to-date base install
- Template partials approach
- Custom add-on development
For those who don’t write add-ons, their first thought is to enable PHP in their templates. Here’s why you shouldn’t:
- It’s notoriously slow
- It’s not user friendly
- It’s not at all portable
- It locks you into a single parsing stage
When using PHP in templates, parsing on input and output are different. Blake shows us how each method is parsed in relation to when ExpressionEngine tags are parsed.
- PHP on Input
- ExpressionEngine Template Tag
- PHP on Output
So why would you want to build a custom plugin?
Breaking down the tag:
exp:eeci:present style="keynote" parse="inward"
- exp - magic
- eeci - class
- present - method
- style, parse - parameters
Where can you go for information?
Places to go for info:
You can build add-ons as either:
- Project Specific - One class, multiple methods for small site specific additions
- Abstracted and Stand-Alone - An add-on with a primary goal, meant for reuse across the board.
ExpressionEngine is a platform we can build stuff on.
Blake then walked through the anatomy of a plugin. (It was really code heavy)
Here are his slides so you can see all the wonderful code.
Update: Blake has posted his code and examples on Github.