Difference between revisions of "Wikipedia Link Mod"

From TNG_Wiki
Jump to navigation Jump to search
(New page: <font color=gray><div align="center" style="text-align: center;font-size: 300%; font-weight: bold; margin: 10px auto;"> '' Wikipedia Link Mod '' </div></font> {|align=right |__TOC__ |} =...)
(No difference)

Revision as of 15:50, 16 December 2008

Wikipedia Link Mod

Purpose of the mod

This mod provides links to Wikipedia for the TNG Place name and for each of the individual segments of the place name.

Advantages

The Wikipedia link mod allows your users to link to Wikipedia:

  • where they may find additional information on the place.
  • where they may find the additional information on the segments of the place name.


Developer

The mod was initially provided on the TNG Forum by Luke Weerts.

Note that Luke initially replaced the Place Name header with a link to Wikipedia. Ken Roy modified Luke's code to add the Wikipedia link information below the Place Name Header and use cust_text.php to provide the indication of a Wikipedia link.


TNG module - placesearch.php

This mod pertains to the placesearch.php script

The following are the instructions on how to install the Wikipedia Link mod.

Where

Add the following after line 236 - applies to TNG 7.0 (this mod is also working in TNG 6.1.3 but the line number is likely are different).

echo tng_DrawHeading( $photostr, $psearchns, "" ); 

What to add

After the TNG generated Place Name header line, add a conditional include.

@include($cms[tngpath] . "extensions/wikipedia_link.php");   // Luke Weert's Wikipedia Link mod 
http://www.tngforum.us/index.php?s=&showtopic=3921&view=findpost&p=18911

Content of wikipedia_link.php

You can create the wikipedia_link.php file from the following content and place the file in the extensions subdirectory of your TNG install directory. Note that you may have to create the subdirectory as a New Folder.

<?php
// Luke Weert's Wikipedia link mod - 
http://www.tngforum.us/index.php?s=&showtopic=3921&view=findpost&p=18911
$citst = explode(",", $psearchns);
$ct = count($citst);
end($citst);
$ct = $ct > 1 ? "," . ($ct > 2 ? prev($citst): current($citst)) : "";
echo "$text[wikilinks]" ."<br />" ; 
echo "<a href=\"http://en.wikipedia.org/wiki/".
    str_ireplace( " ", "_",$citst[0] . $ct) . "\" target=\"_blank\">";
echo "$psearchns "; 
echo "</a><br />";
function wikis($nam,$nu)
{
$nam = trim($nam);
echo " [<a href=\"http://en.wikipedia.org/wiki/".
    str_ireplace( " ", "_",$nam) . "\">". $nam . "</a>] ";
};
array_walk($citst, 'wikis'); 
?>

Co-requesite custom text

In your English/cust_text.php, add

// Added for Wikipedia Searchplace mod by Luke Weerts 
$text[wikilinks] = "Wikipedia links for";

In your French/cust_text.php, add

// Added for Wikipedia Searchplace mod by Luke Weerts 
$text[wikilinks] = "Wikipedia liens pour";

You will need to add similar text for your other languages.

Visual of mod

See sites using the mod below for visual.

TNG User sites using this mod

  • Please add TNG site that you have found that utilize this modification

Site List