SlideShare a Scribd company logo
1 of 34
Download to read offline
Hacking
Movable
Type
        Day
2
    A
guide
for
developers


      Six
Apart
Ltd.

                             Page

Review

• Day
1:
The
Basics
  – Plugin
Structure
  – The
Registry
  – ConfiguraBon
DirecBves
  – Template
Tags
  – Objects
  – Callbacks




                                        2
                                     Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  ➡ Introduc<on
to
Movable
Type
Applica<ons
  – Menus
  – New
ApplicaBon
Screens
  – Dialogs
  – LisBng
Screens
  – Transformer
Callbacks




                                                 3
                                              Page

IntroducBon
to
MT
Apps
• A
collecBon
of
features
that
manifest
in
a
coherent

  interface.
• Each
has
a
dedicated
.cgi
• Why?
   – Portability
   – OpBmizaBon




                                                         Page

Example
Apps
•   Atom
‐
Atom
Publishing
Protocol
•   CMS
‐
the
Main
MT
ApplicaBon
•   XML‐RPC
‐
RESTian
interfaces
•   Feeds
‐
AcBvity
Feeds
•   Search
‐
Blog
Side
Searching
•   Comments
‐
Comment
Processing
•   More..




                                      Page

Apps
in
the
Registry
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example plugin for Movable Type.
version: 1.0
applications:
  my_app:

 
      cgi_base:

 
      handler:

 
      methods:

 
      page_actions:

 
      list_actions:

 
      list_filters:

 
      search_apis:

 
      menus:

 
      widgets:

 
      blog_stats_tab:

 
      tags:

 
      import_formats:



                                                                  Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  ➡ Menus
  – New
ApplicaBon
Screens
  – Dialogs
  – LisBng
Screens
  – Transformer
Callbacks




                                                 7
                                              Page

Menus




        Page

Adding
Menus
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example plugin.
version: 1.0
applications:
     cms:
          menus:
              create:video:
                  label: 'Upload Video'
                  mode: 'video_upload'
                  order: 301
                  args:
  

    
 
 
 
         '_type': quot;blogquot;
                  permission: 'manage_assets,publish_post'
                  view: blog




                                                             Page

Menu
ProperBes
•   label
•   mode
•   dialog
•   order
•   permission
•   args
•   view


                                  Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  – Menus
  ➡ New
Applica<on
Screens
  – Dialogs
  – LisBng
Screens
  – Transformer
Callbacks




                                               11
                                              Page

CreaBng
a
New
Screen
in
the
App
•   Extending
different
apps
•   Registering
a
“mode”
•   ImplemenBng
a
Handler
•   CreaBng
a
template
•   Working
with
Templates




                                  Page

Registering
a
Mode
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example plugin.
version: 1.0
applications:
  cms:
    methods:

 
        do_something: $Example::Example::Plugin::do_something




                                                                   Page

Mode
Handlers
package Example::Plugin;
use strict;

sub plugin {
  return MT->component('Example');
}

sub some_mode {
  my $app = shift;
  my $input = $app->{query}->param('some_form_parameter');
  my $plugin = plugin();
  my $tmpl = $plugin->load_tmpl('some_template.tmpl');
  return $app->build_page( $tmpl );}
}




                                                        Page

CreaBng
a
Template
<mt:setvarblock name=quot;page_titlequot;>This is a page
  title</mt:setvarblock>
<mt:include name=quot;include/header.tmplquot;>
<p>Hello World!</p>
<mt:include name=quot;include/footer.tmplquot;>




                                                   Page

Including
Custom
Javascript
<mt:setvarblock name=quot;page_titlequot;>This is a page title</
   mt:setvarblock>
<mt:setvarblock name=quot;html_headquot; append=quot;1quot;>
<script type=quot;text/javascriptquot;>
<!--
function do_something(f) {
     alert(quot;Something!quot;);
}
// -->
</script>
</mt:setvarblock>
<mt:include name=quot;include/header.tmplquot;>




                                                           Page

Forms
<mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock>
<mt:include name=quot;include/header.tmplquot;>
<form method=quot;postquot; enctype=quot;multipart/form-dataquot; action=quot;<mt:var name=quot;script_urlquot;>quot;>
<input type=quot;hiddenquot; name=quot;__modequot; value=quot;a_modequot; />
<mt:if name=quot;blog_idquot;>
<input type=quot;hiddenquot; name=quot;blog_idquot; value=quot;<mt:var name=quot;blog_idquot;>quot; />
</mt:if>
<input type=quot;hiddenquot; name=quot;magic_tokenquot; value=quot;<mt:var name=quot;magic_tokenquot;>quot; />
<mtapp:setting
    id=quot;some_id_fieldquot;
    label=quot;Enter text herequot;
    hint=quot;Yay, text.quot;
    content_class=quot;field-content-textquot;>
    <input type=quot;textquot; name=quot;fooquot; size=quot;30quot; />
</mtapp:setting>
<mt:setvarblock name=quot;action_buttonsquot;>
    <button
         type=quot;submitquot;
         accesskey=quot;squot;
         title=quot;Continue (s)quot;
         class=quot;primary-buttonquot;>Continue</button>
</mt:setvarblock>
<mt:include name=quot;include/actions_bar.tmplquot; bar_position=quot;bottomquot; hide_pager=quot;1quot; settings_bar=quot;1quot;>
</form>
<mt:include name=quot;include/footer.tmplquot;>




                                                                                                     Page

Working
with
Variables
<mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock>
<mt:include name=quot;include/header.tmplquot;>
<p>Hello <mt:var name=quot;personquot;>!</p>
<mt:include name=quot;include/footer.tmplquot;>


sub some_mode {
  my $app = shift;
  my $input = $app->{query}->param('some_form_parameter');
  my $plugin = plugin();
  my $param = {};
  $param->{person} = quot;Byrne”;
  my $tmpl = $plugin->load_tmpl('some_template.tmpl');
  return $app->build_page( $tmpl, $param );
}




                                                                          Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  – Menus
  – New
ApplicaBon
Screens
  ➡ Dialogs
  – LisBng
Screens
  – Transformer
Callbacks




                                               19
                                              Page

Dialogs




          Page

Dialog
Template
<mt:var name=quot;page_titlequot; value=quot;My Dialog Titlequot;>
<mt:include name=quot;dialog/header.tmplquot;>
<!-- insert your page content here -->
<mt:include name=quot;dialog/footer.tmplquot;>




                                                     Page

Dialog
Bu^ons
 <form ....>
        <!-- insert form fields here -->

 
     <div class=quot;actions-barquot;>

 
         <div class=quot;actions-bar-inner pkg actionsquot;>

 
             <button

 
                 type=quot;buttonquot;

 
                 accesskey=quot;squot;

 
                 class=quot;primary-button closequot;>Confirm</button>

 
             <button

 
                 onclick=quot;closeDialog(); return falsequot;

 
                 type=quot;submitquot;

 
                 class=quot;cancelquot;

 
                 accesskey=quot;xquot;

 
                 title=quot;Cancel (x)quot;>Cancel</button>

 
         </div>

 
     </div>

 </form>


                                                                Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  – Menus
  – New
ApplicaBon
Screens
  – Dialogs
  ➡ Lis<ng
Screens
  – Transformer
Callbacks




                                               23
                                              Page

LisBng
Screens




                 Page

LisBng
Template
Stub

   <mt:setvar name=quot;page_titlequot; value=quot;My Listingquot;>

   <mt:setvarblock name=quot;html_headquot; append=quot;1quot;></mt:setvarblock>

   <mt:setvarblock name=quot;system_msgquot;></mt:setvarblock>
    <mt:setvarblock name=quot;related_contentquot;></mt:setvarblock>


   <mt:setvarblock name=quot;html_body_footerquot;>

       <mt:include name=quot;include/display_options.tmplquot;>

   </mt:setvarblock>


   <mt:setvarblock name=quot;action_buttonsquot;></mt:setvarblock>


   <mt:include name=quot;include/header.tmplquot;>


   <div class=quot;listing-filterquot;>

     <div class=quot;listing-filter-inner inner pkgquot;></div>

   </div>


   <mtapp:listing id=“my-table-id” type=quot;profileeventquot;

       default=quot;No events could be found.quot;

       empty_message=quot;No events could be found.quot;>

   </mtapp:listing>


   <mt:include name=quot;include/footer.tmplquot;>



                                                                    Page

LisBng
Template

   <mtapp:listing type=quot;mybojectquot;

       default=quot;No my objects could be found.quot;

       empty_message=quot;No my objects could be found.quot;>

   
       <mt:if name=quot;__first__quot;>

   
         <thead>

   
           <tr>

   
             <th class=quot;cbquot;><input type=quot;checkboxquot; id=quot;select-all-checkboxquot;

   
                name=quot;id-headquot; value=quot;allquot; class=quot;selectquot; /></th>

   
             <th>Column 1</th>

          
 <th>Column 2</th>

   
       
        <th>A Date</th>

   
           </tr>

   
         </thead>

   
         <tbody>

   
       </mt:if>

   
       <tr class=quot;<mt:if name=quot;__odd__quot;>odd<mt:else>even</mt:if>quot;>

   
         <td class=quot;cbquot;>

   
           <input type=quot;checkboxquot; name=quot;idquot;

   
               value=quot;<mt:var name=quot;idquot;>quot; class=quot;selectquot; />

   
         </td>

   
         <td><mt:var name=quot;column1quot; remove_html=quot;1quot;></td>

   
         <td><mt:var name=quot;column2quot; remove_html=quot;1quot;></td>

   
         <td><mt:var name=quot;datequot; remove_html=quot;1quot;></td>

   
       </tr>

   </mtapp:listing>




                                                                                   Page

LisBng
Handler

   sub list_profileevent {

       my $app = shift;

       my %param = @_;


       # Send the user to the dashboard if no blog ID has been provided.

       $app->return_to_dashboard( redirect => 1 ) if $app->param('blog_id');


       my %service_styles;

       my @service_styles_loop;


   
       # This anonymous subroutine will process each row of data. It takes

   
       # as input the object associated with the current row, and an empty

   
       # hash for the row that should be populated with content from the

   
       # $obj passed to it.

       my $code = sub {

            my ($obj, $row) = @_;

            $row->{'column1'} = $obj->some_property;

            $row->{'column2'} = $obj->another_property;

            my $ts = $row->{created_on};

            $row->{date} = relative_date($ts, time);

       };


   
       # %terms is used in case you want to filter the contents of the

   
       # table in someway

       my %terms = (

            author_id => $app->user->id,

       );




                                                                                  Page

LisBng
Handler

   
       # %args is used in case you want to sort or otherwise modify the

   
       # query arguments of the table

       my %args = (

           sort => 'created_on',

           direction => 'descend',

       );


   
       # %params is an addition hash of input parameters into the template

   
       # and can be used to hold an arbitrary set of name/value pairs that

   
       # can be displayed in your template.

   
       my %params = (

   
       
      some_variable => 'You can do ANYTHING in Movable Type',

   
       );


   
       # Fetch an instance of the current plugin using the plugin's key

       my $plugin = MT->component('Example');


   
       # The main work horse of your handler. This will actually conduct

   
       # the query to the database for you, populate all that is necessary

   
       # for the pagination controls and more. The query is filtered and

   
       # controlled using the %terms and %args parameters.

       $app->listing({

           type     => 'myobject', # the ID of the object in the registry

           terms    => %terms,

           args     => %args,

           listing_screen => 1,

           code     => $code,

           template => $plugin->load_tmpl('my_table.tmpl'),

           params   => %params,

       });

   }



                                                                                  Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  – Menus
  – New
ApplicaBon
Screens
  – Dialogs
  – LisBng
Screens
  ➡ Transformer
Callbacks




                                               29
                                              Page

Transformer
Callbacks




                        Page

Callback
Types
• Transform
the
template’s
source:
  – MT::App::CMS::template_source
• Transform
the
template’s
DOM:
  – MT::App::CMS::template_param
• Transform
the
template’s
output:
  – MT::App::CMS::template_output




                                     Page

Registering
the
Callback
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example.
version: 1.0
callbacks:
    MT::App::CMS::template_source.edit_entry: 
          $Example::Example::Plugin::xfrm




                                                  Page

Regular
Express
Callback
sub my_xfrm_callback {
  my ($cb, $app, $tmpl) = @_;
  my $slug = <<END_TMPL;
A whole bunch of HTML here
END_TMPL
  $$tmpl =~ s/(<li>Utilitiesn<ul class=quot;subquot;>)/$1$slug/;
}




                                                        Page

Thank
you!

    Byrne
Reese
byrne@sixapart.com



                     Page


More Related Content

What's hot

User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!Greg Bell
 
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Juliano Martins
 
Mozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: BasicMozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: Basiclittlebtc
 
Essential html tweaks for accessible themes
Essential html tweaks for accessible themesEssential html tweaks for accessible themes
Essential html tweaks for accessible themesMartin Stehle
 
Desenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoDesenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoJuliano Martins
 
Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011Zi Bin Cheah
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事Sofish Lin
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
plumbing for the next web
plumbing for the next webplumbing for the next web
plumbing for the next webIan Forrester
 
In some simple steps, your site can stand out from the rest. Here's how...
In some simple steps, your site can stand out from the rest. Here's how... In some simple steps, your site can stand out from the rest. Here's how...
In some simple steps, your site can stand out from the rest. Here's how... British Council
 
Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Maurizio Pelizzone
 
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet VikingAndrew Collier
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIWP Engine
 
JSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph PicklJSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph PicklChristoph Pickl
 
Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]Aaron Gustafson
 
The Structure of Web Code: A Case For Polymer, November 1, 2014
The Structure of Web Code: A Case For Polymer, November 1, 2014The Structure of Web Code: A Case For Polymer, November 1, 2014
The Structure of Web Code: A Case For Polymer, November 1, 2014Tommie Gannert
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching ResurrectedBen Scofield
 
Optaros Surf Code Camp Dispatcher
Optaros Surf Code Camp DispatcherOptaros Surf Code Camp Dispatcher
Optaros Surf Code Camp DispatcherJeff Potts
 

What's hot (20)

User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!
 
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
 
Mozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: BasicMozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: Basic
 
Essential html tweaks for accessible themes
Essential html tweaks for accessible themesEssential html tweaks for accessible themes
Essential html tweaks for accessible themes
 
Desenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoDesenvolvimento Mobile Híbrido
Desenvolvimento Mobile Híbrido
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011
 
Seven Reasons for Code Bloat
Seven Reasons for Code BloatSeven Reasons for Code Bloat
Seven Reasons for Code Bloat
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
plumbing for the next web
plumbing for the next webplumbing for the next web
plumbing for the next web
 
In some simple steps, your site can stand out from the rest. Here's how...
In some simple steps, your site can stand out from the rest. Here's how... In some simple steps, your site can stand out from the rest. Here's how...
In some simple steps, your site can stand out from the rest. Here's how...
 
Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress
 
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
 
JSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph PicklJSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph Pickl
 
Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]
 
The Structure of Web Code: A Case For Polymer, November 1, 2014
The Structure of Web Code: A Case For Polymer, November 1, 2014The Structure of Web Code: A Case For Polymer, November 1, 2014
The Structure of Web Code: A Case For Polymer, November 1, 2014
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
 
Optaros Surf Code Camp Dispatcher
Optaros Surf Code Camp DispatcherOptaros Surf Code Camp Dispatcher
Optaros Surf Code Camp Dispatcher
 

Viewers also liked

CIM Personal Branding 2011 #CIMbrandyou
CIM Personal Branding 2011 #CIMbrandyouCIM Personal Branding 2011 #CIMbrandyou
CIM Personal Branding 2011 #CIMbrandyouLisa Harris
 
Online Communities
Online CommunitiesOnline Communities
Online CommunitiesByrne Reese
 
Conference Driven Publishing
Conference Driven PublishingConference Driven Publishing
Conference Driven PublishingDave Cross
 
Timespeople Community Features
Timespeople Community FeaturesTimespeople Community Features
Timespeople Community FeaturesByrne Reese
 
Building Web Sites With Movable Type
Building Web Sites With Movable TypeBuilding Web Sites With Movable Type
Building Web Sites With Movable TypeByrne Reese
 
Melody Designer Training
Melody Designer TrainingMelody Designer Training
Melody Designer TrainingByrne Reese
 

Viewers also liked (6)

CIM Personal Branding 2011 #CIMbrandyou
CIM Personal Branding 2011 #CIMbrandyouCIM Personal Branding 2011 #CIMbrandyou
CIM Personal Branding 2011 #CIMbrandyou
 
Online Communities
Online CommunitiesOnline Communities
Online Communities
 
Conference Driven Publishing
Conference Driven PublishingConference Driven Publishing
Conference Driven Publishing
 
Timespeople Community Features
Timespeople Community FeaturesTimespeople Community Features
Timespeople Community Features
 
Building Web Sites With Movable Type
Building Web Sites With Movable TypeBuilding Web Sites With Movable Type
Building Web Sites With Movable Type
 
Melody Designer Training
Melody Designer TrainingMelody Designer Training
Melody Designer Training
 

Similar to Developing for Movable Type in 2 Days

Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009Ricardo Varela
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Librariesjeresig
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On RailsWen-Tien Chang
 
Yakov Fain - Design Patterns a Deep Dive
Yakov Fain - Design Patterns a Deep DiveYakov Fain - Design Patterns a Deep Dive
Yakov Fain - Design Patterns a Deep Dive360|Conferences
 
Introduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePointIntroduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePointGeoff Varosky
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkDirk Haun
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialYi-Ting Cheng
 
Wai Aria - An Intro
Wai Aria - An IntroWai Aria - An Intro
Wai Aria - An IntroMatt Machell
 
How Not To Code Flex Applications
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applicationsjeff tapper
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NETgoodfriday
 
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...Jazkarta, Inc.
 
Neil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItNeil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItCarsonified Team
 
From jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutesedill3484
 
4 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 202101054 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 20210105John Picasso
 
Pluginが広げるRailsの魅力
Pluginが広げるRailsの魅力Pluginが広げるRailsの魅力
Pluginが広げるRailsの魅力Yoji Shidara
 

Similar to Developing for Movable Type in 2 Days (20)

Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
 
Yakov Fain - Design Patterns a Deep Dive
Yakov Fain - Design Patterns a Deep DiveYakov Fain - Design Patterns a Deep Dive
Yakov Fain - Design Patterns a Deep Dive
 
Introduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePointIntroduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePoint
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
Gae
GaeGae
Gae
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
 
Wai Aria - An Intro
Wai Aria - An IntroWai Aria - An Intro
Wai Aria - An Intro
 
How Not To Code Flex Applications
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applications
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
 
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
 
Neil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItNeil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do It
 
From jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutes
 
Satchmo
SatchmoSatchmo
Satchmo
 
4 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 202101054 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 20210105
 
Pluginが広げるRailsの魅力
Pluginが広げるRailsの魅力Pluginが広げるRailsの魅力
Pluginが広げるRailsの魅力
 
T5 Oli Aro
T5 Oli AroT5 Oli Aro
T5 Oli Aro
 
BluePrint Mobile Framework
BluePrint Mobile FrameworkBluePrint Mobile Framework
BluePrint Mobile Framework
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Developing for Movable Type in 2 Days

  • 1. Hacking
Movable
Type Day
2 A
guide
for
developers Six
Apart
Ltd. Page

  • 2. Review • Day
1:
The
Basics – Plugin
Structure – The
Registry – ConfiguraBon
DirecBves – Template
Tags – Objects – Callbacks 2 Page

  • 3. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces ➡ Introduc<on
to
Movable
Type
Applica<ons – Menus – New
ApplicaBon
Screens – Dialogs – LisBng
Screens – Transformer
Callbacks 3 Page

  • 4. IntroducBon
to
MT
Apps • A
collecBon
of
features
that
manifest
in
a
coherent
 interface. • Each
has
a
dedicated
.cgi • Why? – Portability – OpBmizaBon Page

  • 5. Example
Apps • Atom
‐
Atom
Publishing
Protocol • CMS
‐
the
Main
MT
ApplicaBon • XML‐RPC
‐
RESTian
interfaces • Feeds
‐
AcBvity
Feeds • Search
‐
Blog
Side
Searching • Comments
‐
Comment
Processing • More.. Page

  • 6. Apps
in
the
Registry name: Example Plugin for Movable Type id: Example key: Example description: This plugin is an example plugin for Movable Type. version: 1.0 applications: my_app: cgi_base: handler: methods: page_actions: list_actions: list_filters: search_apis: menus: widgets: blog_stats_tab: tags: import_formats: Page

  • 7. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons ➡ Menus – New
ApplicaBon
Screens – Dialogs – LisBng
Screens – Transformer
Callbacks 7 Page

  • 8. Menus Page

  • 9. Adding
Menus name: Example Plugin for Movable Type id: Example key: Example description: This plugin is an example plugin. version: 1.0 applications: cms: menus: create:video: label: 'Upload Video' mode: 'video_upload' order: 301 args: '_type': quot;blogquot; permission: 'manage_assets,publish_post' view: blog Page

  • 10. Menu
ProperBes • label • mode • dialog • order • permission • args • view Page

  • 11. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons – Menus ➡ New
Applica<on
Screens – Dialogs – LisBng
Screens – Transformer
Callbacks 11 Page

  • 12. CreaBng
a
New
Screen
in
the
App • Extending
different
apps • Registering
a
“mode” • ImplemenBng
a
Handler • CreaBng
a
template • Working
with
Templates Page

  • 13. Registering
a
Mode name: Example Plugin for Movable Type id: Example key: Example description: This plugin is an example plugin. version: 1.0 applications: cms: methods: do_something: $Example::Example::Plugin::do_something Page

  • 14. Mode
Handlers package Example::Plugin; use strict; sub plugin { return MT->component('Example'); } sub some_mode { my $app = shift; my $input = $app->{query}->param('some_form_parameter'); my $plugin = plugin(); my $tmpl = $plugin->load_tmpl('some_template.tmpl'); return $app->build_page( $tmpl );} } Page

  • 15. CreaBng
a
Template <mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> <p>Hello World!</p> <mt:include name=quot;include/footer.tmplquot;> Page

  • 16. Including
Custom
Javascript <mt:setvarblock name=quot;page_titlequot;>This is a page title</ mt:setvarblock> <mt:setvarblock name=quot;html_headquot; append=quot;1quot;> <script type=quot;text/javascriptquot;> <!-- function do_something(f) { alert(quot;Something!quot;); } // --> </script> </mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> Page

  • 17. Forms <mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> <form method=quot;postquot; enctype=quot;multipart/form-dataquot; action=quot;<mt:var name=quot;script_urlquot;>quot;> <input type=quot;hiddenquot; name=quot;__modequot; value=quot;a_modequot; /> <mt:if name=quot;blog_idquot;> <input type=quot;hiddenquot; name=quot;blog_idquot; value=quot;<mt:var name=quot;blog_idquot;>quot; /> </mt:if> <input type=quot;hiddenquot; name=quot;magic_tokenquot; value=quot;<mt:var name=quot;magic_tokenquot;>quot; /> <mtapp:setting id=quot;some_id_fieldquot; label=quot;Enter text herequot; hint=quot;Yay, text.quot; content_class=quot;field-content-textquot;> <input type=quot;textquot; name=quot;fooquot; size=quot;30quot; /> </mtapp:setting> <mt:setvarblock name=quot;action_buttonsquot;> <button type=quot;submitquot; accesskey=quot;squot; title=quot;Continue (s)quot; class=quot;primary-buttonquot;>Continue</button> </mt:setvarblock> <mt:include name=quot;include/actions_bar.tmplquot; bar_position=quot;bottomquot; hide_pager=quot;1quot; settings_bar=quot;1quot;> </form> <mt:include name=quot;include/footer.tmplquot;> Page

  • 18. Working
with
Variables <mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> <p>Hello <mt:var name=quot;personquot;>!</p> <mt:include name=quot;include/footer.tmplquot;> sub some_mode { my $app = shift; my $input = $app->{query}->param('some_form_parameter'); my $plugin = plugin(); my $param = {}; $param->{person} = quot;Byrne”; my $tmpl = $plugin->load_tmpl('some_template.tmpl'); return $app->build_page( $tmpl, $param ); } Page

  • 19. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons – Menus – New
ApplicaBon
Screens ➡ Dialogs – LisBng
Screens – Transformer
Callbacks 19 Page

  • 20. Dialogs Page

  • 21. Dialog
Template <mt:var name=quot;page_titlequot; value=quot;My Dialog Titlequot;> <mt:include name=quot;dialog/header.tmplquot;> <!-- insert your page content here --> <mt:include name=quot;dialog/footer.tmplquot;> Page

  • 22. Dialog
Bu^ons <form ....> <!-- insert form fields here --> <div class=quot;actions-barquot;> <div class=quot;actions-bar-inner pkg actionsquot;> <button type=quot;buttonquot; accesskey=quot;squot; class=quot;primary-button closequot;>Confirm</button> <button onclick=quot;closeDialog(); return falsequot; type=quot;submitquot; class=quot;cancelquot; accesskey=quot;xquot; title=quot;Cancel (x)quot;>Cancel</button> </div> </div> </form> Page

  • 23. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons – Menus – New
ApplicaBon
Screens – Dialogs ➡ Lis<ng
Screens – Transformer
Callbacks 23 Page

  • 24. LisBng
Screens Page

  • 25. LisBng
Template
Stub <mt:setvar name=quot;page_titlequot; value=quot;My Listingquot;> <mt:setvarblock name=quot;html_headquot; append=quot;1quot;></mt:setvarblock> <mt:setvarblock name=quot;system_msgquot;></mt:setvarblock> <mt:setvarblock name=quot;related_contentquot;></mt:setvarblock> <mt:setvarblock name=quot;html_body_footerquot;> <mt:include name=quot;include/display_options.tmplquot;> </mt:setvarblock> <mt:setvarblock name=quot;action_buttonsquot;></mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> <div class=quot;listing-filterquot;> <div class=quot;listing-filter-inner inner pkgquot;></div> </div> <mtapp:listing id=“my-table-id” type=quot;profileeventquot; default=quot;No events could be found.quot; empty_message=quot;No events could be found.quot;> </mtapp:listing> <mt:include name=quot;include/footer.tmplquot;> Page

  • 26. LisBng
Template <mtapp:listing type=quot;mybojectquot; default=quot;No my objects could be found.quot; empty_message=quot;No my objects could be found.quot;> <mt:if name=quot;__first__quot;> <thead> <tr> <th class=quot;cbquot;><input type=quot;checkboxquot; id=quot;select-all-checkboxquot; name=quot;id-headquot; value=quot;allquot; class=quot;selectquot; /></th> <th>Column 1</th> <th>Column 2</th> <th>A Date</th> </tr> </thead> <tbody> </mt:if> <tr class=quot;<mt:if name=quot;__odd__quot;>odd<mt:else>even</mt:if>quot;> <td class=quot;cbquot;> <input type=quot;checkboxquot; name=quot;idquot; value=quot;<mt:var name=quot;idquot;>quot; class=quot;selectquot; /> </td> <td><mt:var name=quot;column1quot; remove_html=quot;1quot;></td> <td><mt:var name=quot;column2quot; remove_html=quot;1quot;></td> <td><mt:var name=quot;datequot; remove_html=quot;1quot;></td> </tr> </mtapp:listing> Page

  • 27. LisBng
Handler sub list_profileevent { my $app = shift; my %param = @_; # Send the user to the dashboard if no blog ID has been provided. $app->return_to_dashboard( redirect => 1 ) if $app->param('blog_id'); my %service_styles; my @service_styles_loop; # This anonymous subroutine will process each row of data. It takes # as input the object associated with the current row, and an empty # hash for the row that should be populated with content from the # $obj passed to it. my $code = sub { my ($obj, $row) = @_; $row->{'column1'} = $obj->some_property; $row->{'column2'} = $obj->another_property; my $ts = $row->{created_on}; $row->{date} = relative_date($ts, time); }; # %terms is used in case you want to filter the contents of the # table in someway my %terms = ( author_id => $app->user->id, ); Page

  • 28. LisBng
Handler # %args is used in case you want to sort or otherwise modify the # query arguments of the table my %args = ( sort => 'created_on', direction => 'descend', ); # %params is an addition hash of input parameters into the template # and can be used to hold an arbitrary set of name/value pairs that # can be displayed in your template. my %params = ( some_variable => 'You can do ANYTHING in Movable Type', ); # Fetch an instance of the current plugin using the plugin's key my $plugin = MT->component('Example'); # The main work horse of your handler. This will actually conduct # the query to the database for you, populate all that is necessary # for the pagination controls and more. The query is filtered and # controlled using the %terms and %args parameters. $app->listing({ type => 'myobject', # the ID of the object in the registry terms => %terms, args => %args, listing_screen => 1, code => $code, template => $plugin->load_tmpl('my_table.tmpl'), params => %params, }); } Page

  • 29. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons – Menus – New
ApplicaBon
Screens – Dialogs – LisBng
Screens ➡ Transformer
Callbacks 29 Page

  • 31. Callback
Types • Transform
the
template’s
source: – MT::App::CMS::template_source • Transform
the
template’s
DOM: – MT::App::CMS::template_param • Transform
the
template’s
output: – MT::App::CMS::template_output Page

  • 32. Registering
the
Callback name: Example Plugin for Movable Type id: Example key: Example description: This plugin is an example. version: 1.0 callbacks: MT::App::CMS::template_source.edit_entry: $Example::Example::Plugin::xfrm Page

  • 33. Regular
Express
Callback sub my_xfrm_callback { my ($cb, $app, $tmpl) = @_; my $slug = <<END_TMPL; A whole bunch of HTML here END_TMPL $$tmpl =~ s/(<li>Utilitiesn<ul class=quot;subquot;>)/$1$slug/; } Page

  • 34. Thank
you! Byrne
Reese byrne@sixapart.com Page