More Related Content
Similar to Phpで作るmovable typeプラグイン
Similar to Phpで作るmovable typeプラグイン (20)
More from Yuji Takayama (20)
Phpで作るmovable typeプラグイン
- 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
- 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];
- 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 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
- 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
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n