Citations Display Mod

From TNG_Wiki
Jump to navigation Jump to search
Citations Mod
Summary Change the citation display in 'Sources' from the short the long title
Validation
Mod Updated {{{mod_last_update}}}
Download link Not applicable
Download stats {{{download_stats}}}
Author(s)
Homepage Citations (This page)
Mod Support
Contact Developer TNG Community Forums
Latest Mod
Min TNG V 6.0.0 requires manual installation
Max TNG V 7.x.x
Files modified
personlib.php
Related Mods
Notes
See related mod for Mod Manager version



Display of Citations in the Sources section

To change the citation display in "sources" from the short titles to the long titles, you'll need to modify these lines in personlib.php (located in the main TNG directory):

In lines 34-42 (v.6.x.x), lines 48-55 (v.7.1.2) you'll see statements:

               if( $citrow[shorttitle] ) {
                       if( $newstring ) $newstring .= ", ";
                       $newstring .= $citrow[shorttitle];
               }
               else if( $citrow[title] ) {
                       if( $newstring ) $newstring .= ", ";
                       $newstring .= $citrow[title];
               }

You need to reverse them to read:

               if( $citrow[title] ) {
                       if( $newstring ) $newstring .= ", ";
                       $newstring .= $citrow[title];
               }
               else if( $citrow[shorttitle] ) {
                       if( $newstring ) $newstring .= ", ";
                       $newstring .= $citrow[shorttitle];
               }

After the changes, source citations will change from this: Citations Short.jpg

to this:

Citations Long.jpg

Note: these modifications were made for the personlib.php file in version 6.2.0. The line numbers may have changed in later versions.

Sorting on Short Title

In order to sort the sources in browsesources.php based on the shorttitle rather than title, you will also need to make the following mod to browsesources.php, according to Darrin as posted on the User List

change the code on line 56:

$query = "SELECT sourceID, title, shorttitle, author, $sources_table.gedcom as gedcom, treename FROM 
$sources_table $join $trees_table on $sources_table.gedcom = $trees_table.gedcom $wherestr ORDER BY 
title LIMIT $newoffset" . $maxsearchresults;

Change the ORDER BY clause from "title" to "shorttitle".

$query = "SELECT sourceID, title, shorttitle, author, $sources_table.gedcom as gedcom, treename FROM 
$sources_table $join $trees_table on $sources_table.gedcom = $trees_table.gedcom $wherestr ORDER BY 
shorttitle LIMIT $newoffset" . $maxsearchresults;

Citation drop-down Menu

If you have some very long citation titles, (particularly a set of volumes), the long names may get chopped off making it difficult to distinguish between one and the other.

To change the drop-down menus to display the short titles rather than the long titles, you'll need to modify admin/addcitation.php and admin/editcitation.php

In admin/addcitation.php:

1. In version 6.x.x on line 28, version 7.1.2 line 35, change title to shorttitle

2a. In version 6.x.x on lines 48 and 52 change $row[title] to $row[shorttitle]

2b. In version 7.1.2 line 39, change title to shorttitle:


In admin/editcitation.php:

1. change title on line 10 (v.6.x.x), line 11 (v.7.1.2) to shorttitle

2. change $source[title] on line 45 (v.6.x.x), line (v.7.1.2) to $source[shorttitle]

Note: these modifications were made for the addcitation.php and editcitation.php files in version 6.2.0. The line numbers may have changed in later versions.