Published by Mijingo

movie icon image

EE Insider Blog

Spend your time learning and developing sites with ExpressionEngine and we'll use this blog to keep you informed of all the news related to ExpressionEngine and CodeIgniter.

» Read more in the Archives.

» Have a tip? Send us your EE news.

Learn ExpressionEngine Today

Over a series of 8 videos, watch and learn as Ryan builds an entire ExpressionEngine website from beginning to end. Get started now.

Blake Walters - Practical Tips For Writing Custom Plugins

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.

  1. PHP on Input
  2. ExpressionEngine Template Tag
  3. PHP on Output

So why would you want to build a custom plugin?

  • Flexible
  • Readability
  • Portability
  • Performance

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.

Posted on Oct 16, 2012 by Kyle Cotter

Filed Under: Conferences, EECI 2012