MT PHP API?
July 19, 2006 3:36 PM Subscribe
Movable Type PHP library: is it possible to use the PHP library in the same fashion as the perl library?
Maybe I am not making sense. MT comes w/ the perl library, e.g. MT.pm, Entry.pm, etc.
I've taken lately to writing shell scripts and cron jobs in PHP, but I have one perl script (and another coming) that must be in perl cos they use the MT library to write an automated entry, e.g.:
$entry = MT::Entry->new;
...
$entry->save;
$mt->rebuild_entry(Entry => $entry, BuildDependencies => true) or die $mt->errstr;
So but lately MT comes with an extensive PHP library (mt directory/php/lib). But it seems like this isn't really a library/API, but rather some basic functions. Is it possible to duplicate the above functionality using MT's php lib?
Maybe I am not making sense. MT comes w/ the perl library, e.g. MT.pm, Entry.pm, etc.
I've taken lately to writing shell scripts and cron jobs in PHP, but I have one perl script (and another coming) that must be in perl cos they use the MT library to write an automated entry, e.g.:
$entry = MT::Entry->new;
...
$entry->save;
$mt->rebuild_entry(Entry => $entry, BuildDependencies => true) or die $mt->errstr;
So but lately MT comes with an extensive PHP library (mt directory/php/lib). But it seems like this isn't really a library/API, but rather some basic functions. Is it possible to duplicate the above functionality using MT's php lib?
I will second that the right way to do this would be through an xml-rpc call, rather than reinventing the wheel.
posted by adamrice at 7:46 AM on July 20, 2006
posted by adamrice at 7:46 AM on July 20, 2006
The PHP library that comes with Movable Type is 99%[1] read-only. It is meant to be used to dynamically render blogs. So there are no functions provided to create entries and/or rebuild the static pages from PHP. XMLRPC is the way to go.
The other alternative is to use the Perl-based API and invoke that script from PHP.
[1]: The 1% I allude to above is a feature of MT 3.31 which lets you save back to the database plugin configuration settings by PHP-based plugins.
posted by bschoate at 1:48 PM on July 20, 2006 [1 favorite]
The other alternative is to use the Perl-based API and invoke that script from PHP.
[1]: The 1% I allude to above is a feature of MT 3.31 which lets you save back to the database plugin configuration settings by PHP-based plugins.
posted by bschoate at 1:48 PM on July 20, 2006 [1 favorite]
This thread is closed to new comments.
For something like this, you'd probably want to use webservices. Thats the usual way to programmatically create/edit/read posts from a blog. I'm sure that MT supports the metaweblog API, so probably the best way to do is to get a PHP metaweblog library and have that talk to MT.
MT & metaweblog - http://www.movabletype.org/siteuk/docs/mtmanual_programmatic.html
metaweblog library in php
These links were from very quick google searches - you may find better resources/libraries if you look harder.
posted by rsanheim at 6:29 AM on July 20, 2006