SlideShare a Scribd company logo
1 of 55
Dynamic Publishing
         ...
Block
   ...
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
$repeat true2
    $repeat false
      Block
      MTIf
     smarty_block_TAGNAME
stash Stash 2
          Stash Stash
          Stash
Function
     ...
smarty_function_TAGNAME
Stash
smarty_function_TAGNAME
Stash
smarty_function_TAGNAME
Stash
Modifier
  ...
smarty_modifier_MODIFIERNAME



 $text   Modifier
smarty_modifier_MODIFIERNAME



 $text   Modifier
smarty_modifier_MODIFIERNAME



 $text   Modifier
$mt = MT::get_instance();
$db = $mt->db();

$args[‘limit’] = 10;
$args[‘offset’] = 10;
$entries = $db->fetch_entries( $args );
if ( !empty( $entries ) ) {
    foreach ( $entries as $e ) {
       // do something...
    }
}
$mt = MT::get_instance();
$db = $mt->db();
$where = “entry_id = 1 and placement_blog_id = 1”;
$extra[‘join’] = array(
 ‘mt_placement’ => array(
     ‘condition’ => ‘placement_entry_id = entry_id’
 ),
);
$extra[‘distinct’] = ‘distinct’;
$extra[‘limit’] = 1;
require_once( ‘class_mt_entry.php’ );
$class = New Entry;
$entries =
 $class->Find( $where, false, false, $extra );
if ( empty( $entries ) ) return null;
$entry = $entries[0];
$mt = MT::get_instance();
$db = $mt->db();

$sql = “delete from mt_session”;
$db->Execute( $sql );
$mt = MT::get_instance();
$db = $mt->db();

require_once(‘class.mt_entry.php’);
$entry = New Entry;
$entry->title = ‘Hello, world.”;
$entry->blog_id = 1;
$entry->author_id = 1;
$entry->save();
$mt = MT::get_instance();
$db = $mt->db();

require_once(‘class.mt_blog.php’);
$blog = New Blog;
$blog->Load( ‘blog_id = 1’ );
echo $blog->id;
echo $blog->blog_page_layout;
require_once(‘class.baseobject.php’);
class NewObject extends BaseObject
{
   public $_table = ‘mt_newobject’;
   protected $_prefix = ‘newobject_’;
   protected $_has_meta = true;
}
ADODB_Active_Record::ClassHasMany(
   'NewObject', 'mt_newobject_meta',
   'newobject_meta_newobject_id'
);
BaseObject::install_meta(
   ‘newobject’,
   'new_meta_column’,
   ‘vchar’
);
•                           BaseObject


•
• Meta
• blog / author / entry                  BaseObject



    • entry_id / author_id / blog_id
mtdb.base.php


     // Construction
     public function __construct($user,
                       $password = '’,
                       $dbname = '',
                       $host = '',
                       $port = '',
                       $sock = '') {
        $this->id = md5(uniqid('MTDatabase',true));
        $this->connect($user, $password,
          $dbname, $host, $port, $sock);
        ADOdb_Active_Record::SetDatabaseAdapter(
          $this->conn);
   #     $this->conn->debug = true;
     }
Phpで作るmovable typeプラグイン
Phpで作るmovable typeプラグイン
Phpで作るmovable typeプラグイン
Phpで作るmovable typeプラグイン

More Related Content

What's hot

“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...Rafael Dohms
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of LithiumNate Abele
 
"Coffee Script" in Brief
"Coffee Script" in Brief"Coffee Script" in Brief
"Coffee Script" in BriefNat Weerawan
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsPierre MARTIN
 
JavaOne 2017 | JShell: The Ultimate Missing Tool
 JavaOne 2017 | JShell: The Ultimate Missing Tool JavaOne 2017 | JShell: The Ultimate Missing Tool
JavaOne 2017 | JShell: The Ultimate Missing ToolHakan Özler
 
What's New in Perl? v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16What's New in Perl?  v5.10 - v5.16
What's New in Perl? v5.10 - v5.16Ricardo Signes
 
Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Karsten Dambekalns
 
Ruby - Uma Introdução
Ruby - Uma IntroduçãoRuby - Uma Introdução
Ruby - Uma IntroduçãoÍgor Bonadio
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Jeff Carouth
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHPmarkstory
 
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksLithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksNate Abele
 
New in cakephp3
New in cakephp3New in cakephp3
New in cakephp3markstory
 
Object Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHPObject Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHPChad Gray
 
Hidden treasures of Ruby
Hidden treasures of RubyHidden treasures of Ruby
Hidden treasures of RubyTom Crinson
 
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesDesarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesLuis Curo Salvatierra
 

What's hot (20)

“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
 
Growing jQuery
Growing jQueryGrowing jQuery
Growing jQuery
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of Lithium
 
"Coffee Script" in Brief
"Coffee Script" in Brief"Coffee Script" in Brief
"Coffee Script" in Brief
 
Coding website
Coding websiteCoding website
Coding website
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
 
JavaOne 2017 | JShell: The Ultimate Missing Tool
 JavaOne 2017 | JShell: The Ultimate Missing Tool JavaOne 2017 | JShell: The Ultimate Missing Tool
JavaOne 2017 | JShell: The Ultimate Missing Tool
 
What's New in Perl? v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16What's New in Perl?  v5.10 - v5.16
What's New in Perl? v5.10 - v5.16
 
Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3
 
Ruby - Uma Introdução
Ruby - Uma IntroduçãoRuby - Uma Introdução
Ruby - Uma Introdução
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4
 
Dades i operadors
Dades i operadorsDades i operadors
Dades i operadors
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHP
 
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksLithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate Frameworks
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
 
New in cakephp3
New in cakephp3New in cakephp3
New in cakephp3
 
Object Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHPObject Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHP
 
Hidden treasures of Ruby
Hidden treasures of RubyHidden treasures of Ruby
Hidden treasures of Ruby
 
PhoneGap: Local Storage
PhoneGap: Local StoragePhoneGap: Local Storage
PhoneGap: Local Storage
 
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesDesarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móviles
 

Similar to Phpで作るmovable typeプラグイン

Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6garux
 
Document Classification In PHP
Document Classification In PHPDocument Classification In PHP
Document Classification In PHPIan Barber
 
Top 10 php classic traps
Top 10 php classic trapsTop 10 php classic traps
Top 10 php classic trapsDamien Seguy
 
究極のコントローラを目指す
究極のコントローラを目指す究極のコントローラを目指す
究極のコントローラを目指すYasuo Harada
 
20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked aboutTatsuhiko Miyagawa
 
The Perl6 Type System
The Perl6 Type SystemThe Perl6 Type System
The Perl6 Type Systemabrummett
 
PHP record- with all programs and output
PHP record- with all programs and outputPHP record- with all programs and output
PHP record- with all programs and outputKavithaK23
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsDavid Golden
 
Document Classification In PHP - Slight Return
Document Classification In PHP - Slight ReturnDocument Classification In PHP - Slight Return
Document Classification In PHP - Slight ReturnIan Barber
 
Climbing the Abstract Syntax Tree (php[world] 2019)
Climbing the Abstract Syntax Tree (php[world] 2019)Climbing the Abstract Syntax Tree (php[world] 2019)
Climbing the Abstract Syntax Tree (php[world] 2019)James Titcumb
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Masahiro Nagano
 
ランダム文字ぽいものをつくる
ランダム文字ぽいものをつくるランダム文字ぽいものをつくる
ランダム文字ぽいものをつくるTetsuji Koyama
 
Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)James Titcumb
 
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)James Titcumb
 
Functional Pe(a)rls version 2
Functional Pe(a)rls version 2Functional Pe(a)rls version 2
Functional Pe(a)rls version 2osfameron
 
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)James Titcumb
 
Climbing the Abstract Syntax Tree (PHP South Africa 2017)
Climbing the Abstract Syntax Tree (PHP South Africa 2017)Climbing the Abstract Syntax Tree (PHP South Africa 2017)
Climbing the Abstract Syntax Tree (PHP South Africa 2017)James Titcumb
 

Similar to Phpで作るmovable typeプラグイン (20)

Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6
 
Document Classification In PHP
Document Classification In PHPDocument Classification In PHP
Document Classification In PHP
 
Daily notes
Daily notesDaily notes
Daily notes
 
Top 10 php classic traps
Top 10 php classic trapsTop 10 php classic traps
Top 10 php classic traps
 
究極のコントローラを目指す
究極のコントローラを目指す究極のコントローラを目指す
究極のコントローラを目指す
 
20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked about
 
The Perl6 Type System
The Perl6 Type SystemThe Perl6 Type System
The Perl6 Type System
 
PHP record- with all programs and output
PHP record- with all programs and outputPHP record- with all programs and output
PHP record- with all programs and output
 
Bag of tricks
Bag of tricksBag of tricks
Bag of tricks
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
 
What Is Security
What Is SecurityWhat Is Security
What Is Security
 
Document Classification In PHP - Slight Return
Document Classification In PHP - Slight ReturnDocument Classification In PHP - Slight Return
Document Classification In PHP - Slight Return
 
Climbing the Abstract Syntax Tree (php[world] 2019)
Climbing the Abstract Syntax Tree (php[world] 2019)Climbing the Abstract Syntax Tree (php[world] 2019)
Climbing the Abstract Syntax Tree (php[world] 2019)
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
ランダム文字ぽいものをつくる
ランダム文字ぽいものをつくるランダム文字ぽいものをつくる
ランダム文字ぽいものをつくる
 
Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)
 
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
 
Functional Pe(a)rls version 2
Functional Pe(a)rls version 2Functional Pe(a)rls version 2
Functional Pe(a)rls version 2
 
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
 
Climbing the Abstract Syntax Tree (PHP South Africa 2017)
Climbing the Abstract Syntax Tree (PHP South Africa 2017)Climbing the Abstract Syntax Tree (PHP South Africa 2017)
Climbing the Abstract Syntax Tree (PHP South Africa 2017)
 

More from Yuji Takayama

Movable Type 7 のすべて
Movable Type 7 のすべてMovable Type 7 のすべて
Movable Type 7 のすべてYuji Takayama
 
詳説 Movable type 7
詳説 Movable type 7詳説 Movable type 7
詳説 Movable type 7Yuji Takayama
 
Data API ことはじめ
Data API ことはじめData API ことはじめ
Data API ことはじめYuji Takayama
 
詳説 Data api mtddc 拡張版 v3対応
詳説 Data api mtddc 拡張版   v3対応詳説 Data api mtddc 拡張版   v3対応
詳説 Data api mtddc 拡張版 v3対応Yuji Takayama
 
初めての Data api cms どうでしょう - 大阪夏の陣
初めての Data api   cms どうでしょう - 大阪夏の陣初めての Data api   cms どうでしょう - 大阪夏の陣
初めての Data api cms どうでしょう - 大阪夏の陣Yuji Takayama
 
Data apiで実現 進化するwebの世界
Data apiで実現 進化するwebの世界Data apiで実現 進化するwebの世界
Data apiで実現 進化するwebの世界Yuji Takayama
 
初めての Data API CMS どうでしょう - 仙台編 -
初めての Data API   CMS どうでしょう - 仙台編 -初めての Data API   CMS どうでしょう - 仙台編 -
初めての Data API CMS どうでしょう - 仙台編 -Yuji Takayama
 
Movable Type for AWS Hands-on
Movable Type for AWS Hands-onMovable Type for AWS Hands-on
Movable Type for AWS Hands-onYuji Takayama
 
初めての Data api
初めての Data api初めての Data api
初めての Data apiYuji Takayama
 
Data API + AWS = (CMS どうでしょう 札幌編)
Data API + AWS =  (CMS どうでしょう 札幌編)Data API + AWS =  (CMS どうでしょう 札幌編)
Data API + AWS = (CMS どうでしょう 札幌編)Yuji Takayama
 
Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!Yuji Takayama
 
MT東京03 - Movable Type for AWS
MT東京03 - Movable Type for AWSMT東京03 - Movable Type for AWS
MT東京03 - Movable Type for AWSYuji Takayama
 
Data api workshop at Co-Edo
Data api workshop at Co-EdoData api workshop at Co-Edo
Data api workshop at Co-EdoYuji Takayama
 
Mtとクラウドと私
Mtとクラウドと私Mtとクラウドと私
Mtとクラウドと私Yuji Takayama
 
Movable Type 6 overview spec3
Movable Type 6 overview spec3Movable Type 6 overview spec3
Movable Type 6 overview spec3Yuji Takayama
 
Movable Type 6 Overview - New York Perl Mongers Tech Talk
Movable Type 6 Overview - New York Perl Mongers Tech TalkMovable Type 6 Overview - New York Perl Mongers Tech Talk
Movable Type 6 Overview - New York Perl Mongers Tech TalkYuji Takayama
 
Movable Type 6 Overview SPEC2
Movable Type 6 Overview SPEC2Movable Type 6 Overview SPEC2
Movable Type 6 Overview SPEC2Yuji Takayama
 
Mtddc2013: Movable Type 6 Overview
Mtddc2013: Movable Type 6 OverviewMtddc2013: Movable Type 6 Overview
Mtddc2013: Movable Type 6 OverviewYuji Takayama
 

More from Yuji Takayama (20)

Movable Type 7 のすべて
Movable Type 7 のすべてMovable Type 7 のすべて
Movable Type 7 のすべて
 
詳説 Movable type 7
詳説 Movable type 7詳説 Movable type 7
詳説 Movable type 7
 
Data API ことはじめ
Data API ことはじめData API ことはじめ
Data API ことはじめ
 
概説 Data API v3
概説 Data API v3概説 Data API v3
概説 Data API v3
 
詳説 Data api mtddc 拡張版 v3対応
詳説 Data api mtddc 拡張版   v3対応詳説 Data api mtddc 拡張版   v3対応
詳説 Data api mtddc 拡張版 v3対応
 
初めての Data api cms どうでしょう - 大阪夏の陣
初めての Data api   cms どうでしょう - 大阪夏の陣初めての Data api   cms どうでしょう - 大阪夏の陣
初めての Data api cms どうでしょう - 大阪夏の陣
 
Data apiで実現 進化するwebの世界
Data apiで実現 進化するwebの世界Data apiで実現 進化するwebの世界
Data apiで実現 進化するwebの世界
 
初めての Data API CMS どうでしょう - 仙台編 -
初めての Data API   CMS どうでしょう - 仙台編 -初めての Data API   CMS どうでしょう - 仙台編 -
初めての Data API CMS どうでしょう - 仙台編 -
 
Movable Type for AWS Hands-on
Movable Type for AWS Hands-onMovable Type for AWS Hands-on
Movable Type for AWS Hands-on
 
初めての Data api
初めての Data api初めての Data api
初めての Data api
 
Data API + AWS = (CMS どうでしょう 札幌編)
Data API + AWS =  (CMS どうでしょう 札幌編)Data API + AWS =  (CMS どうでしょう 札幌編)
Data API + AWS = (CMS どうでしょう 札幌編)
 
Data API 2.0
Data API 2.0Data API 2.0
Data API 2.0
 
Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
 
MT東京03 - Movable Type for AWS
MT東京03 - Movable Type for AWSMT東京03 - Movable Type for AWS
MT東京03 - Movable Type for AWS
 
Data api workshop at Co-Edo
Data api workshop at Co-EdoData api workshop at Co-Edo
Data api workshop at Co-Edo
 
Mtとクラウドと私
Mtとクラウドと私Mtとクラウドと私
Mtとクラウドと私
 
Movable Type 6 overview spec3
Movable Type 6 overview spec3Movable Type 6 overview spec3
Movable Type 6 overview spec3
 
Movable Type 6 Overview - New York Perl Mongers Tech Talk
Movable Type 6 Overview - New York Perl Mongers Tech TalkMovable Type 6 Overview - New York Perl Mongers Tech Talk
Movable Type 6 Overview - New York Perl Mongers Tech Talk
 
Movable Type 6 Overview SPEC2
Movable Type 6 Overview SPEC2Movable Type 6 Overview SPEC2
Movable Type 6 Overview SPEC2
 
Mtddc2013: Movable Type 6 Overview
Mtddc2013: Movable Type 6 OverviewMtddc2013: Movable Type 6 Overview
Mtddc2013: Movable Type 6 Overview
 

Phpで作るmovable typeプラグイン

  • 1.
  • 2.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Block ...
  • 12.
  • 13. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 14. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 15. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 16. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 17. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 18. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 19. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 20. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 21. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 22. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 23. $repeat true2 $repeat false Block MTIf smarty_block_TAGNAME stash Stash 2 Stash Stash Stash
  • 24. Function ...
  • 25.
  • 30.
  • 34.
  • 35.
  • 36. $mt = MT::get_instance(); $db = $mt->db(); $args[‘limit’] = 10; $args[‘offset’] = 10; $entries = $db->fetch_entries( $args ); if ( !empty( $entries ) ) { foreach ( $entries as $e ) { // do something... } }
  • 37.
  • 38.
  • 39.
  • 40. $mt = MT::get_instance(); $db = $mt->db(); $where = “entry_id = 1 and placement_blog_id = 1”; $extra[‘join’] = array( ‘mt_placement’ => array( ‘condition’ => ‘placement_entry_id = entry_id’ ), ); $extra[‘distinct’] = ‘distinct’; $extra[‘limit’] = 1; require_once( ‘class_mt_entry.php’ ); $class = New Entry; $entries = $class->Find( $where, false, false, $extra ); if ( empty( $entries ) ) return null; $entry = $entries[0];
  • 41. $mt = MT::get_instance(); $db = $mt->db(); $sql = “delete from mt_session”; $db->Execute( $sql );
  • 42.
  • 43. $mt = MT::get_instance(); $db = $mt->db(); require_once(‘class.mt_entry.php’); $entry = New Entry; $entry->title = ‘Hello, world.”; $entry->blog_id = 1; $entry->author_id = 1; $entry->save();
  • 44. $mt = MT::get_instance(); $db = $mt->db(); require_once(‘class.mt_blog.php’); $blog = New Blog; $blog->Load( ‘blog_id = 1’ ); echo $blog->id; echo $blog->blog_page_layout;
  • 45.
  • 46.
  • 47. require_once(‘class.baseobject.php’); class NewObject extends BaseObject { public $_table = ‘mt_newobject’; protected $_prefix = ‘newobject_’; protected $_has_meta = true; } ADODB_Active_Record::ClassHasMany( 'NewObject', 'mt_newobject_meta', 'newobject_meta_newobject_id' ); BaseObject::install_meta( ‘newobject’, 'new_meta_column’, ‘vchar’ );
  • 48. BaseObject • • Meta • blog / author / entry BaseObject • entry_id / author_id / blog_id
  • 49.
  • 50.
  • 51. mtdb.base.php // Construction public function __construct($user, $password = '’, $dbname = '', $host = '', $port = '', $sock = '') { $this->id = md5(uniqid('MTDatabase',true)); $this->connect($user, $password, $dbname, $host, $port, $sock); ADOdb_Active_Record::SetDatabaseAdapter( $this->conn); # $this->conn->debug = true; }

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n