Thursday, July 23, 2009

Tuesday, July 21, 2009

coustom sql query on propel

$dbMap = Propel::getDatabaseMap();
$con = Propel::getConnection();
$sql = 'xxx sql query...';
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
return XXXPeer::populateObjects($rs);

Monday, July 13, 2009

get google search result

http://code.google.com/intl/zh-CN/apis/ajaxsearch/documentation/

$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Paris%20Hilton";

// sendRequest
// note how referer is set manually
$ch
= curl_init();
curl_setopt
($ch, CURLOPT_URL, $url);
curl_setopt
($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt
($ch, CURLOPT_REFERER, "http://www.mysite.com/index.html");
$body
= curl_exec($ch);
curl_close
($ch);

// now, process the JSON string
$json
= json_decode($body);
// now have some fun with the results...

Wednesday, July 8, 2009

sort links on wordpress

wp_list_bookmarks($args = '') {
$defaults = array(
'orderby' => 'rating'


Change the orderby parameter in function wp_list_bookmarks.