Writing Your First Plugin - Presentation Transcript
Writing your first EE
Plugin
George Ornbo
shapeshed.com
@shapeshed
Hello!
• London-based
• EE Pro Network
• github.com/shapeshed
Don’t miss this
http://net.tutsplus.com/tutorials/
cmss/building-your-first-
expressionengine-plugin/
Plugins, Extensions
Modules. WTF?
• Plugins are simple run-time enhancements
• Extensions extend core functionality
• Modules interact with a database and
generally have a control panel
Starting out
• Basic PHP
• Understanding of
templates and tags
• Willpower
Mummy!
• It is not as hard as it
seems
• There’s help available in
the forums
• It greatly enhances your
offering as a developer
Plugins solve small
problems
• Client: I want all the titles on the site to
have the first letter of each word
capitalised
• You: Can’t the editors fix that?
• Client: There are 2000 articles.
• You: OK Big Boy. Time for a plugin.
A typical weblog loop
Plugin setup
Naming the bits
• The filename for a plugin should
pi.class_name.php (all lowercase)
• The class should be Class_name (first word
uppercase only)
• The function should match the Class name
exactly
Adding plugin info
Add usage info
Add to /system/plugins/
It is easy to get this
wrong
• The plugin may not
show up in the control
panel
• The plugin page in your
control panel may error
• You may get no output
from your plugin
Do the magic
Add to your template
What this does
• Takes the the input from the title tag
• Sends it to the plugin
• The plugin makes the first letter of each
word uppercase
• This is returned and displayed by the
template
• e.g. “My article title” becomes “My Article
Title”
Job done.
What about EE 2.0?
• Built on CodeIgniter
• Plugins need to be ported
• Generally not that difficult
• CodeIgniter brings a lot of libraries and
good things
Porting to EE 2.0
Other changes
• Upload to /system/expressionengine/
thirdparty/pluginname/
• Weblogs are channels
• Global classes are replaced by the EE Super
Object $this->EE =& get_instance();
LE FIN
• Slides and example plugin available at
shapeshed.com/talks
• Photos Creative Commons Licensed from
Flickr: radville, its*me*red, craigmdennis,
bfick
0 comments
Post a comment