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プラグイン

Phpで作るmovable typeプラグイン

  • 3.
  • 11.
    Block ...
  • 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.
  • 26.
  • 27.
  • 28.
  • 29.
  • 31.
  • 32.
  • 33.
  • 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... } }
  • 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 );
  • 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;
  • 47.
    require_once(‘class.baseobject.php’); class NewObject extendsBaseObject { 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
  • 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; }