Adding Images to Search Results (Drupal Search)

For a while (earlier in my Drupal career), I was avoiding adding imagefield-attached images to nodes that appeared in my search results, because I remember the first time I tried doing so, I was still quite confused by the way drupal handled search results theming.

Well, after another crack at it, I finally have a nice, performant way of displaying images from nodes added via imagefields (or in drupal 7, image fields) inline with search results, and it didn't require much work at

Images in Search Results

Nike+跑步運動社交化

有時我已搞不清楚,我究竟是為聽歌而跑步,還是為跑步而聽歌。

大概是四年前,我開始迷上 Nike+ 這玩意,因為自己是用家,我除了對這產品情有獨鍾,我更欣賞此產品背後的營銷策略,所以,在我於HKU Space教授的一個品牌管理碩

Continue reading...

為信仰辭職?

香港內地及政制事務局長林瑞麟提出「替補機制」時的囂張無理,激起公憤,七一遊行有十多萬人,大概也有點拜他所賜。相信很多香港人希望林瑞麟引咎辭職,一群基督徒則在 Facebook 發起一個聯署群組,標題是「 公民牧函 :要求高

Dear Googlebot: SMTP is not HTTP

From the logs of a SMTP server here:

32301#  remote from [66.249.67.36]32301r  GET /robots.txt HTTP/1.132301w  550 Syntax error32301r  Host: 128.100.3.51:2532301w  550 Unknown command 'Host'32301

口頭政治與時事

每個人身邊總有幾個口頭政治時事家,他們能夠從美國獨立歷史開始,經過甲午戰爭,分辨三民主義和網球場宣言,再論述本地政制發展的左派與泛民之爭,然後評論中港人口流動問題 (亦即蝗蟲說),到地產霸權、官商勾結及

談幽默

IPO的生與死

又收不到律師費。白做。

上司 Eric 整個上午都神經兮兮,一早回到辦公室即鬆開領帶,滿頭大汗。他平日最喜歡出來周圍八卦吹水,今天卻一直把自己關在房裏。最離奇的是,秘書放在他桌上的那片 blueberry cheese cake 他居然一口

談幽默

文章跟女人一樣,只有好看與不好看兩種。不好看的文章,即使作者擁有三個博士學位,依然很不環保,浪費紙張。對區區一篇文章尚且如此,可想而知大家對女人會有幾harsh。

那何謂好的演講?「幽默大師」林語堂認為演講必須

Programmatically adding and removing roles to users in Drupal

[UPDATE: Here is a much simpler method for editing a user's roles .]

I thought there might be some sort of API function that allows me to add a user role to a user object by the role id (rid), but after looking at user_save() and some other information around the Drupal universe ( like this thread ), it looks like it's not as easy as I'd hoped. Definitely not like node_save(), where you just modify the


又要靚又要真

( 圖源 )

可以肯定,女人是化了妝比較漂亮的,而事實上男人對漂亮的女人,根本就沒有抵抗能力,所以女人化妝是非常合理。

不過問題是,問到男人的意見呢,即使是女明星,大家總是一致地口臭︰「落左妝就嚇死人呢。」眼

新生 • 道德困惑 • 康德

這兩星期大學裏有不少學生迎新活動,我和幾個同事都要負責一點新生輔導,主要是解答學生有關主修哲學的問題,例如應該先修哪些科目、某些科目是否有特別要求等等。今天我遇到一個有趣的新生(叫他 K),跟他談了近一