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

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

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