开发者

Drupal + Location Module: How to query blog entry locations

I am using the Location module within Drupal 6 to tag geographical locations to blog entries. So every blog entry has a long/la开发者_运维问答t

My question is: What is the most efficient way of querying all coordinates for all blog entries of a given user?


I don't know the location modules db setup. But it probably stores it data in it's own table with a nid (node id) to reference which blog post it is for. Nodes have the uid (user id) of the user who posted it so you should be able to do a query on the locations left joining the node table.

"SELECT geo FROM {location} l LEFT JOIN {node} n ON l.nid = n.nid WHERE n.uid = %d"

The above query used with db_query is just to give an idea. I don't know the exact table layout, but something like that should work just fine.


Location itself also integrates with Views; in addition to providing fields and filters for Locations, it also offers basic proximity filtering and sorting features.

Install Views module, add filter = blog and argument of user id. Add fields of location module that will show coordinates...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜