/[drupal]/contributions/modules/geonames/README.txt
ViewVC logotype

Contents of /contributions/modules/geonames/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Sat Aug 18 03:36:10 2007 UTC (2 years, 3 months ago) by lyricnz
Branch: MAIN
CVS Tags: DRUPAL-6--2-0, DRUPAL-6--1-0, DRUPAL-6--1-1, DRUPAL-6--1-2, DRUPAL-6--1-2-BETA1, HEAD
Branch point for: DRUPAL-6--1, DRUPAL-6--2
Changes since 1.1: +54 -1 lines
File MIME type: text/plain
A module to include geocoded Wikipedia results in searches (with possible
thumbnails).
1 The GeoNames contrib project is a collection of modules to integrate with
2 the webservers and data provided by GeoNames http://www.geonames.org/
3
4
5
6 =======================================================================
7 GeoNames Wikipedia Search: Integrate Wikipedia Results into Search
8 =======================================================================
9
10 Creates a new search type "Wikipedia" that includes results from
11 http://www.geonames.org/export/wikipedia-webservice.html#wikipediaSearch
12
13 The results provided by the module also include all values from the XML, including
14 coordinates and a thumbnail image.
15
16 [entry] => Array
17 (
18 [lang] => en
19 [title] => Stock Exchange Tower
20 [summary] => at 125 Old Broad Street. Standing at 103 m (339 feet) tall, with 26 floors, the tower was completed in 1970. It served as the headquarters and offices for the London Stock Exchange until its departure for new premises in Paternoster Square, in July 2004. ''Face to face'' trading was conducted on the trading floor of the exchange, until it was abolished in favour of electronic trading (...)
21 [feature] =>
22 [population] => 0
23 [elevation] => 0
24 [lat] => 51.5144
25 [lng] => -0.0867
26 [wikipediaUrl] => http://en.wikipedia.org/wiki/Stock_Exchange_Tower
27 [thumbnailImg] => http://www.geonames.org/img/wikipedia/11000/thumb-10323-100.jpg
28 )
29
30 These could be themed something like
31
32 /**
33 * Include a thumbnail in wikipedia search results (provided by geonames/wikipedia_search.module)
34 */
35 function yourmodule_search_item($item, $type) {
36 switch ($item['type']) {
37 case 'wikipedia':
38 // Add coordinates to the extra information
39 $entry = $item['entry'];
40 $item['extra'] = array('LAT:' . $entry['lat'], 'LONG:' . $entry['lng']);
41 // Add a thumbnail image to the results
42 if ($entry['thumbnailImg']) {
43 $img_html = theme('image', $entry['thumbnailImg'], $item['title'], $item['title'], NULL, FALSE);
44 $link_html = l($img_html, $item['link'], array(), NULL, NULL, FALSE, TRUE);
45 $item['snippet'] = $link_html . $item['snippet'];
46 }
47 $html = theme_search_item($item, $type);
48 break;
49 default:
50 $html = theme_search_item($item, $type);
51 break;
52 }
53 return $html;
54 }
55

  ViewVC Help
Powered by ViewVC 1.1.2