How to make ecto work with Ultimate Tag Warrior

I once wrote about “How to make ecto work with Jerome’s Keywords“. Unfortunately, Jerome’s Keywords does not work well with Wordpress 2.0. With suggestion from Meng Yan, I switched to Ultimate Tag Warrior. Again, I met the problem of how to make ecto work with it. Here’s the solution.

  1. make sure Ecto is using Movable Type API to contact with your wordpress. You can check it out in the Account settings.
  2. set up the template of tags in Ecto. Set the “Tag separator” as “,” which is the default setting and “Put tags in” as “keywords” which is NOT the default setting.
  3. update the xmlrpc.php in the directory of your blog system. add the following line into the function mw_newPost and mw_editPost after where $content_struct is initialized:

$_POST['tagset'] = $content_struct['mt_keywords'];

Here’s the sample code to show where to make the modification (below the comments “ROBINLU HACK”):

/* metaweblog.newPost creates a post */
function mw_newPost($args) {
global $wpdb, $post_default_category;
... ...
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];
// ROBIN LU HACK
$_POST['tagset'] = $content_struct['mt_keywords'];
$comment_status = (empty($content_struct['mt_allow_comments'])) ?
... ...
}
... ...
/* metaweblog.editPost ...edits a post */
function mw_editPost($args) {
global $wpdb, $post_default_category;
$this->escape($args);
$post_ID     = $args[0];
... ...
$post_title = $content_struct['title'];
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
$catnames = $content_struct['categories'];
// ROBINLU HACK
$_POST['tagset'] = $content_struct['mt_keywords'];
$post_category = array();
... ...
}

Update: See Part II to get ecto fully functional with UTW.

42 条评论

How to make ecto work with Jerome’s Keywords

The support for tags in Wordpress 1.5.2 still depends on plugins. I use Jerome’s Keywords for this purpose. However, it does not work well with Ecto. I digged into the source code of the plugin and wordpress implementation of xml-rpc a bit. Although I am not familiar with php, I managed to make Ecto work with Jerome’s Keywords plugin. Here’s how to do it:

  1. make sure Ecto is using Movable Type API to contact with your wordpress. You can check it out in the Account settings.
  2. set up the template of tags in Ecto. Set the “Tag separator” as “,” which is the default setting and “Put tags in” as “keywords” which is NOT the default setting.
  3. update the xmlrpc.php in the directory of your blog system. add the following line into the function mw_newPost and mw_editPost after where $content_struct is initialized:

$_REQUEST['keywords_list'] = $content_struct['mt_keywords'];

Have a try with your Ecto. Set tags when you are composing blogs. After publishing, you can find the tags you set in ecto work just fine with Jerome’s Keywords Plugin.

If you have no interesting in how it works, you can stop here. Now I’d like to explain how I made it.

First, Ecto supports submit tag information as keyword with Movable Type API as mt_keywords. What you have to do is just to enable it in Templates settings. Meanwhile, Jerome’s Keywords hooks the action “publish_post” and “edit_post” to add keywords into post meta table. It extracts the keyword from the HTML REQUEST. So, my hack is to fake the request parameter “keywords_list” with the information in mt_keywords. They happend to use the same structure to present the tags so all I have to do is to add a single line in each post related method in xmlrpc.php

2 条评论

开始使用ecto

ecto,一个Mac OS X下很不错的blogging客户端。没错,我是可以通过浏览器登录到网站上更新管理blog,但那实在不是什么愉快的经历,服务器的延迟,简陋的编辑功能,浏览器崩溃的危险,完全是对耐心和毅力的考验。
ecto支持很多blog系统,包括我使用的wordpress。功能方面,支持多blog账户,有不错的管理和编辑界面,可定制的html tag快捷键,完整的MovableType API的支持,对于mac用户整合了iPhoto和iTunes。还有很多我这种light blogger搞不太清楚的功能。
ecto是一个shareware,可以试用20天,在劝你付钱的时候可谓动之以情晓之以理,虽然里面提到的星巴克我并不经常光顾,但不到20美元的价格确实和一顿火锅也可类比。现在仍然很想再读一遍那段劝诱文字,只是我已经付过钱了。

1条评论

Recent Posts:

Recent Comments:

Archive:

Tags:

Bookmarks:

My music:

About Me:

I am a software engineer in Beijing, China. I write code for work and for fun. I am interested in web technology, life hacking and console games. This blog is dumped from my left brain.
View Robin Lu's profile on LinkedIn

My Flickr:

    scribbleAt Modern Sky Music FestivalIMG_0389IMG_0312urumqi panaramaIMG_9664

Friends: