Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome to San Francisco Perl Mongers Wireless Network Info: SSID: melody No WEP, no keys, nada. Sponsored by.

Similar presentations


Presentation on theme: "Welcome to San Francisco Perl Mongers Wireless Network Info: SSID: melody No WEP, no keys, nada. Sponsored by."— Presentation transcript:

1 Welcome to San Francisco Perl Mongers Wireless Network Info: SSID: melody No WEP, no keys, nada. Sponsored by

2 Byrne Reese Manager, Platform Technology Six Apart, Ltd. October 20, 2005 Building on the

3 Page 3 overview Introductions About Six Apart Why Movable Type? Your First Plugin

4 Page 4 me Product Manager Open Source Hacker CPAN Contributor (SOAP::Lite) Movable Type Plugin Developer

5 Page 5 six apart 10+ million bloggers using our software to share their lives, experiences and opinions with their friends, their families and the world. plus, a company of perl experts, hackers and enthusiasts

6 Page 6 our modules XML::Feed XML::FOAF WWW::Blog::Metadata XML::Atom XML::Atom::Filter SOAP::Lite Net::OpenID LWP::ParanoidAgent Perlbal SWF::Chart Crypt::OpenSSL::DSA Text::Textile :Find Mac::MacBinary plus over a hundred more…

7 Page 7 movabletype a platform highly extensible plugin architecture large community of developers free! not a product…

8 Page 8 a platform Plugins can range from the very simple to the very complex. SimpleComplex

9 Page 9 a platform Template Tags Text Filters SimpleComplex Examples: IfEmpty ModifiedOn Textile Markdown Ajaxify

10 Page 10 a platform StatWatch Add one template tag and… Get hit stats for your blog. One template tag A one-page user interface SimpleComplex

11 Page 11 a platform StyleCatcher MT Template Plugin Action Complex Javascript UI Support for multiple template libraries SimpleComplex

12 Page 12 a platform SpamLookup Complex set of plugin actions for filtering incoming comments Expert use of MT’s plugin configuration framework SimpleComplex

13 Page 13 a platform Media Manager Third party integration Dedicated User Interface Alternative templates Overloaded modes SimpleComplex

14 Page 14 a platform Not to mention plugins for: Feedburner plugin PayPal Firewalls Editorial Workflow Podcasting …you name it. SimpleComplex

15 Page 15 pronet you are not alone… hundreds of members strong articles, docs and mailing lists plugin directory a community of developers…

16 Page 16 pronet …and professionals gig leads promote yourself deals on conferences free technical support

17 Page 17 your first plugin

18 Page 18 creating your plugin package MT::Plugin::MyPlugin; use MT; use base qw(MT::Plugin); use vars qw($VERSION); sub BEGIN { $VERSION = '1.0'; my $plugin; $plugin = new MT::Plugin::MyPlugin({ name => 'Photo Gallery', version => $VERSION, description => ‘A description.', doc_link => '', author_name => 'Byrne Reese', author_link => 'http://www.majordojo.com/', }); MT->add_plugin($plugin); }

19 Page 19 registering your plugin place your plugin.pl file in the plugins directory your plugin will appear among the other plugins in MT’s Plugins Control Panel

20 Page 20 template tags

21 Page 21 a simple tag MT::Template::Context->add_tag(HelloWorld => \&helloworld); sub helloworld { my ($context, $args) my $who = $args->{who} || “World”; if ($who eq “Byrne”) { return $context->error(“Please don’t feed the animals”); } return “Hello $who”; } #

22 Page 22 a container tag MT::Template::Context->add_container_tag(HelloWorld => \&helloworld); sub helloworld { my ($context, $args) my $who = $args->{who} || “World”; my $res; my $builder = $ctx->stash('builder'); my $tokens = $ctx->stash('tokens'); foreach my $p (split(“,”,$who) { $ctx->stash(‘who', $p); defined(my $out = $builder->build($context, $tokens)) or return $ctx->error($context->errstr); $res.= $out; } $res; }

23 Page 23 a container tag (continued) MT::Template::Context->add_tag(Who => \&who); sub who { my ($context, $args) my $who = $context->stash(‘who’); return $who; } # #

24 Page 24 a conditional tag MT::Template::Context->add_conditional_tag(IfByrne => \&ifbyrne); sub ifbyrne { my ($context, $args) my $who = $context->stash(‘who’); return $who =~ /Byrne/i; } # # Please don’t feed the animals. # #

25 Page 25 text filters

26 Page 26 a simple text filter MT->add_text_filter(‘bfil’, { label => "Byrne’s Filter ", on_format => &filter, docs => ‘url’}); sub filter { my ($str, $context) $str =~ s#Byrne# \1 #gi return $str; }

27 Page 27 building a UI of your own

28 Page 28 MT::App your plugin == a tiny MT contains all of your application logic package MyPlugin::App; use strict; use = qw( MT::App ); sub init { my $app = shift; my %param $app->SUPER::init(%param) or return; $app->add_methods(‘hello’ => &hello); return $app; } sub hello { my $app = shift; $app->l10n_filter( “hello world” ); }

29 Page 29 creating a cgi script dispatches requests to your MT::App MT::Bootstrap #!/usr/bin/perl # # My Movable Type Plugin use strict; use lib "lib", ($ENV{MT_HOME} ? "$ENV{MT_HOME}/lib" : "../../lib"); use MT::Bootstrap App => ‘MyPlugin::App'; __END__

30 Page 30 MT::Object package MediaManager::Entry; use strict; use = qw( MT::Object ); __PACKAGE__->install_properties({ column_defs => { 'id' => 'integer not null auto_increment', 'blog_id' => 'integer not null', 'title' => 'string(150) not null', 'catalog' => 'string(50) not null', 'isbn' => 'string(50) not null', 'entry_id' => 'integer' }, indexes => { blog_id => 1, }, audit => 1, datasource => 'mediamanager', primary_key => 'id', }); abstracts developer away from SQL and database

31 Page 31 MT::Object methods load and load_iter save remove count exists my %constraints; $constraints{blog_id} = $blog_id; $constraints{status} = $show if $show ne 'all'; $constraints{catalog} = $catalog if $catalog ne 'all'; my %options; $options{sort} = $sort; $options{direction} = direction => $acs ? 'ascend' : 'descend'; $options{limit} = $limit if $limit ne 'none'; $options{offset} = $offset; my $iter = MediaManager::Entry->load_iter( \%constraints, \%options );

32 Page 32 etcetera alt-templates junk filters callbacks advanced plugin actions integrated plugin settings interface BigPAPI

33 Page 33 oh yeah…

34 Page 34 we’re hiring ;)

35 Page 35 discussion


Download ppt "Welcome to San Francisco Perl Mongers Wireless Network Info: SSID: melody No WEP, no keys, nada. Sponsored by."

Similar presentations


Ads by Google