Difference between revisions of "Wikipedia Link Mod"

From TNG_Wiki
Jump to navigation Jump to search
m (→‎Automated Install: changed config file name to all lower case)
Line 1: Line 1:
 +
{{TNGmod
 +
| mod_name        = Wikipedia Link Mod
 +
| mod_summary    = Adds links to Wikipedia for place name in the Place Search page
 +
| download_link  = [[Media: wikipedia_link_v1.1.zip| wikipedia_link_v1.1.zip]]
 +
| mod_author      = Luke Weerts<br />Ken Roy enhanced and created config file
 +
| mod_url        = [[Wikipedia Link Mod]] (This page)
 +
| mod_support    = [http://www.tngforum.us/ TNG Forums]
 +
| mod_version    = 1.1
 +
| use_mod_manager = Yes
 +
| manual_install  = Yes, but no longer recommended and may not be current
 +
| min_TNG_ver    = 7.0.0
 +
| max_TNG_ver    = 7.1.2
 +
| TNG_file_list  = placesearch.php
 +
| related_mods    = None
 +
| notes          = Please update your additional language cust_text.php files with translations based upon the [[Wikipedia_Link _Mod#Custom_Text_Additions|Custom Text Additions]] for this mod.
 +
}}
 +
{|align=right
 +
|__TOC__
 +
|}
 +
 
{|align=right
 
{|align=right
 
|__TOC__
 
|__TOC__
Line 5: Line 25:
 
== Purpose of the 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.
+
This mod provides links to Wikipedia for the TNG Place name and for each of the individual segments of the place name in the Place Search page.
  
 
== Advantages ==
 
== Advantages ==
Line 22: Line 42:
 
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.
 
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.
 
   
 
   
 +
==Requirements==
 +
 +
* A working TNG installation. The automated installation release was initially tested at TNG Version 7.1.0. Manual installation previously used on TNG 6 and 7.
 +
* A backup of your TNG placesearch.php file.
 +
* An installed current version of the [[Mod Manager]].
 +
 
== Automated Install ==
 
== Automated Install ==
  
# An installed current version of the [[Mod Manager]].
+
# Download [[Media: wikipedia_link_v1.1.zip | wikipedia_link_v1.1.zip]]  
# Download the [[Media:wikipedia_link_v1.1.zip | wikipedia_link_v1.1.zip]]  
+
# Extract the zip file in your TNG admin/mod_folder
# After downloading the appropriate config file, unzip it into the admin/mod_folder, and then follow the normal automated installation for [[Mod Manager]] mods.
+
# Follow the normal automated installation for Mod Manager, as shown in the example [[Mod Manager - Installing Config Files]] to install the ''' wikipedia_link_v1.1.cfg'''.
  
 
'''Note''' that config file only includes the English language changes, so if you support multiple languages you will need to modify the config file to add the custom text for those other languages.  The config file is also slightly different in that the Wikipedia links now all open in a separate window.
 
'''Note''' that config file only includes the English language changes, so if you support multiple languages you will need to modify the config file to add the custom text for those other languages.  The config file is also slightly different in that the Wikipedia links now all open in a separate window.
 +
 +
== Custom Text Additions ==
 +
 +
'''Note''' that config file only includes the English language changes, so if you support multiple languages you will need to modify the config file to add the custom text for those other languages.
 +
 +
See [[Wikipedia_Link_Mod#English.2Fcust_text.php|English/cust_text.php]] for the custom text will be added to your English/cust_text.php file by this mod. 
 +
 +
If you are using other languages, you must add these lines to each of your language cust_text.php files with appropriate translations of course, for example you would add to the [[Wikipedia_Link_Mod#French.2Fcust_text.php|French/cust_text.php]]
  
 
== Manual Install ==  
 
== Manual Install ==  
 +
 +
<span style="color: red">No longer recommended and may not be current.</span>
 +
 
The following are the manual install instructions for modifying placesearch.php
 
The following are the manual install instructions for modifying placesearch.php
  
Line 80: Line 117:
 
=== Co-requesite custom text ===
 
=== Co-requesite custom text ===
  
 +
==== English/cust_text.php ====
 
In your English/cust_text.php, add
 
In your English/cust_text.php, add
  
Line 87: Line 125:
 
</pre>
 
</pre>
  
 +
 +
==== French/cust_text.php ====
 
In your French/cust_text.php, add
 
In your French/cust_text.php, add
 
<pre>
 
<pre>
Line 95: Line 135:
 
You will need to add similar text for your other languages.
 
You will need to add similar text for your other languages.
  
== Visual of mod ==
+
== Visualization of this mod ==
 +
 
 +
=== Without Mod ===
 +
{|
 +
|
 +
Without this mod, the Place Search page does not include any links to Wikipedia as shown in the image on the right.
 +
|[[Image:Wikipedia_link_not_installed.jpg|500px|right]]
 +
|}
 +
 
 +
=== With Mod Installed ===
  
See sites using the mod below for visual.
+
{|
 +
|
 +
With the ShowTable Mod, the Place Search page does includes two different sets links to Wikipedia as shown in the image on the right:
 +
* a link that uses all parts of the place location name
 +
* separate links to each distinct component of the place location name, such as Joigny (city), Yonne (department), Burgundy (Region), France (country) shown in the image
 +
|[[Image:Wikipedia_link_installed.jpg.jpg|500px|right]]
 +
|}
  
 
== TNG User sites using this mod ==
 
== TNG User sites using this mod ==

Revision as of 09:34, 20 December 2009

Wikipedia Link Mod
Summary Adds links to Wikipedia for place name in the Place Search page
Validation {{{mod_validation}}}
Mod Updated {{{mod_last_update}}}
Download link wikipedia_link_v1.1.zip
Download stats {{{download_stats}}}
Author(s) Luke Weerts
Ken Roy enhanced and created config file
Homepage Wikipedia Link Mod (This page)
Mod Support TNG Forums
Contact Developer {{{mod_contact}}}
Latest Mod 1.1
Min TNG V 7.0.0
Max TNG V 7.1.2
Files modified
placesearch.php
Related Mods
None
Notes
Please update your additional language cust_text.php files with translations based upon the Custom Text Additions for this 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 in the Place Search page.

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.

Requirements

  • A working TNG installation. The automated installation release was initially tested at TNG Version 7.1.0. Manual installation previously used on TNG 6 and 7.
  • A backup of your TNG placesearch.php file.
  • An installed current version of the Mod Manager.

Automated Install

  1. Download wikipedia_link_v1.1.zip
  2. Extract the zip file in your TNG admin/mod_folder
  3. Follow the normal automated installation for Mod Manager, as shown in the example Mod Manager - Installing Config Files to install the wikipedia_link_v1.1.cfg.

Note that config file only includes the English language changes, so if you support multiple languages you will need to modify the config file to add the custom text for those other languages. The config file is also slightly different in that the Wikipedia links now all open in a separate window.

Custom Text Additions

Note that config file only includes the English language changes, so if you support multiple languages you will need to modify the config file to add the custom text for those other languages.

See English/cust_text.php for the custom text will be added to your English/cust_text.php file by this mod.

If you are using other languages, you must add these lines to each of your language cust_text.php files with appropriate translations of course, for example you would add to the French/cust_text.php

Manual Install

No longer recommended and may not be current.

The following are the manual install instructions for modifying placesearch.php

Where

Add the following after line 236 (TNG 7.0-7.0.3) line 239 (TNG 7.1) (this mod is also working in TNG 6.1.3 but the line number 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_replace( " ", "_",$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_replace( " ", "_",$nam) . "\">". $nam . "</a>] ";
};
array_walk($citst, 'wikis'); 
?>

Co-requesite custom text

English/cust_text.php

In your English/cust_text.php, add

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


French/cust_text.php

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.

Visualization of this mod

Without Mod

Without this mod, the Place Search page does not include any links to Wikipedia as shown in the image on the right.

Wikipedia link not installed.jpg

With Mod Installed

With the ShowTable Mod, the Place Search page does includes two different sets links to Wikipedia as shown in the image on the right:

  • a link that uses all parts of the place location name
  • separate links to each distinct component of the place location name, such as Joigny (city), Yonne (department), Burgundy (Region), France (country) shown in the image
Wikipedia link installed.jpg.jpg

TNG User sites using this mod

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

Site List