User Pages - Getting Started

From TNG Wiki
Jump to: navigation, search

User pages are TNG pages that are not part of the delivered package, but that you create. You must also create the links to your user pages, since the TNG menus (as delivered) will not link to them.

The easiest way to create user pages is to edit the historytemplate.php file with an ASCII text editor like Notepad++, PSPad, TextWrangler on the Mac, or Windows Notepad.

Since the historytemplate.php is setup to run from a subdirectory, if the file you are creating will not be residing in the histories directory, you may want to create a user or extrapgs subdirectory as indicated below.

Essentially, the steps are:

  • Create an extrapgs or user subdirectory
  • Open the historytemplate.php
  • Save it with a different name in the subdirectory
  • Edit the saved page and replace the text as shown in Editing new file

Editing new file

You must remove lines 2-4

  1. //Remove the following two lines before deploying copies of this file to the "histories" folder.
  2. echo "Please remove this line and the \"exit\" line that follows before deploying this file to the \"histories\" folder.";
  3. exit;

which generate the following error display

Please remove this line and the "exit" line that follows before deploying this file to the "histories" folder.

Note that you should ignore the comment on line 6 in the historytemplate.php that says

  1. //Replace all the "include" lines in your pre-5.x histories with the following lines (up to the next comment)

Those instructions are for TNG 5 and prior users who want to upgrade their user-created files that were created before the historytemplate.php was distributed.

edit title

You should provide your own title for the tng_header function call in line 27 (in the file before lines 2-4 are removed)

  1. tng_header( "Your Title Here", $flags );

This can be either enter the text directly, such as Your Ancestor's Story

tng_header( "Your Ancestor's Story", $flags );

or as a $text variable, such as $text['ancestorstory']

tng_header( "$text['ancestorstory']", $flags );

where the variable in the English/cust_text.php is defined as

$text['ancestorstory'] = "Your Ancestor's Story";

and in the French/cust_text.php as

$text['ancestorstory'] = "L'histoire de votre ancêtre";

edit log

You must also update line 18 (in the file before lines 2-4 are removed) for the log string

  1. $logstring = "<a href=\"/path_to_your_history_folder/this_file_name\">Your Title Here</a>";

with the same text used for the tng_header function call and with the actual path and name of the file you are creating. For example,

$logstring = "<a href=\"extrapgs/feature1.php\">Your Ancestor's Story</a>";

or as

$logstring = "<a href=\"extrapgs/feature1.php\">$text['ancestorstory']</a>";

edit page content

You must replace the following text in lines 30-33 (in the file before lines 2-4 are removed)

  1. Your history goes here (do not include a BODY tag). IMPORTANT: In order for links on this page to work, you
  2. must edit your custom header, footer and meta files (see General Settings for their specific names) and make sure all file and internal link references are *absolute* and not relative.
  3. In other words, the default ''meta.html'' file contains a relative link to the style sheet "genstyle.css". To
  4. make it absolute, prefix that with the path from your root folder (i.e., "/genealogy/genstyle.css").

with your own text. For example, you could enter something like the following to add a Feature Story for Template 4.

<p class="header">Feature 1 Story</p>

This is the story of our first ancestor who came to Quebec (New France) from Joigny, France in June 1665 with the Carignan-Saliere Regiment which had been dispatched by the King of France to Quebec to help fight the Iroquois Indians.

remove pull down menu

If you don't want the pull down menu on your user created page, you can remove the comments ( // ) at the beginning of line 26 (in the file before lines 2-4 are removed)

  1. //$flags[noicons] = true;

add TNG icons

If you want to add the TNG Home Search Print Login and Bookmark icons on your user-created page, you will need to add

<?php echo tng_coreicons(); ?>

after your header line for example

<p class="header">Feature 1 Story</p>
<?php echo tng_coreicons(); ?>

add links

See Coding Links in Pages for information on how to add Previous and Next links to link pages together.

add media

See Media-Add Media to Extra Page for information on how to add media to your User Pages.

Extrapgs Subfolder

Since the historytemplate.php is designed to be used in the histories subfolder, you should create a subfolder to save your pages, such as user or extrapgs as shown by Dave Freeman in his Word document that explains how to use the historytemplate.php file.

If you are creating your user page in the same folder where you installed TNG, then you will need to adjust the beginning of the file (lines 7-9 (in the file before lines 2-4 are removed) in historytemplate.php) as follows:

  1. include( "begin.php");   //Nuke users must include "../../../begin.php" here
  2. if( !$cms['support'] )
  3.         $cms['tngpath'] = "";

If you are creating your user page in a sub folder to your extrapgs or user subfolder, for example extrapgs/roy or extrapgs/boucher, then you will need to adjust the beginning of the file (lines 7-9 (in the file before lines 2-4 are removed) in historytemplate.php) as follows:

  1. include( "../../begin.php");   //Nuke users must include "../../../begin.php" here
  2. if( !$cms['support'] )
  3.         $cms['tngpath'] = "../../";


Note that the following comment on the include("../begin.php"); line pertains to Nuke CMS environments and does not apply when you are creating user pages unless you are also running a CMS.

//Nuke users must include "../../../begin.php" here


Absolute Paths

The custom header, footer, and meta files should also be using absolute paths.

Most of the templates for TNG 7.0 and above were updated to use $cms['tngpath'] to provide the absolute path.

Extra Pages Document Download

See User Created Pages in TNG Forum which provides a download the Word Document that describes Dave Freeman's process used to create user pages

Related Links

User Pages - Multi-Language

ASCII editors:

Coding Tips: