Difference between revisions of "User Pages - Getting Started"

From TNG_Wiki
Jump to navigation Jump to search
(Text replacement - "http://www.tngforum.us/" to "https://tng.community/index.php?/forums/")
(33 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<font color=gray><div align="center" style="text-align: center;font-size: 200%; font-weight: bold; margin: 10px auto;">
+
{{Languages}}
'' User Pages - Getting Started ''
 
</div></font>
 
<br><font color=red><div align="center" style="text-align: center;font-size: 200%; font-weight: bold; margin: 10px auto;"> '' Article Under Construction '' </div></font><br>
 
 
 
 
{|align=right
 
{|align=right
 
|__TOC__
 
|__TOC__
 
|}
 
|}
  
{|
+
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-plus-plus|Notepad++]], [[PSPad]], or Windows Notepad.
+
The easiest way to create user pages is to edit the ''historytemplate.php'' file  
 +
with an ASCII text editor like [[Notepad-plus-plus|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.
  
* Open the historytemplate.php
+
Essentially, the steps are:
* Save it with a different name
+
* 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
 
* Edit the saved page and replace the text as shown in Editing new file
  
 
== Editing new file ==  
 
== Editing new file ==  
  
You must removed '''lines 2-4''' which generate the following error display
+
You must remove '''lines 2-4'''  
 +
 
 +
<syntaxhighlight lang="html4strict" line start="2" highlight="2,3,4" enclose="div">
 +
//Remove the following two lines before deploying copies of this file to the "histories" folder.
 +
echo "Please remove this line and the \"exit\" line that follows before deploying this file to the \"histories\" folder.";
 +
exit;
 +
</syntaxhighlight>
 +
 
 +
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
  
<pre>
+
<syntaxhighlight lang="html4strict" line start="6" enclose="div">
Please remove this line and the "exit" line that follows before deploying this
+
//Replace all the "include" lines in your pre-5.x histories with the following lines (up to the next comment)
file to the "histories" folder.
+
</syntaxhighlight>
</pre>
+
 
 +
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 ===
 
=== edit title ===
You should provide your own title for the tng_header function call in '''line 27''' before removing lines 2-4.
+
You should provide your own title for the ''tng_header'' function call in '''line 27''' (in the file before lines 2-4 are removed)
  
This can be either text entered directly, such as
+
<syntaxhighlight lang="php" line start="27" enclose="div">
 +
tng_header( "Your Title Here", $flags );
 +
</syntaxhighlight>
  
'''Your Ancestor's Story'''
+
This can be either enter the text directly, such as '''Your Ancestor's Story'''
or could be entered as a $text variable, suce as $text[ancestorstory] where the
+
<syntaxhighlight lang="php" enclose="div">
variable in the English/cust_text.php is defined as
+
tng_header( "Your Ancestor's Story", $flags );
 +
</syntaxhighlight>
 +
or as a $text variable, such as $text['ancestorstory']  
  
$text[ancestorstory] = "Your Ancestor's Story";
+
<syntaxhighlight lang="php" enclose="div">
 +
tng_header( "$text['ancestorstory']", $flags );
 +
</syntaxhighlight>
 +
where the variable in the '''English/cust_text.php''' is defined as
  
and in the French/cust_text.php as
+
<syntaxhighlight lang="php" enclose="div">
 +
$text['ancestorstory'] = "Your Ancestor's Story";
 +
</syntaxhighlight>
  
$text[ancestorstory] = "L'histoire de votre ancêtre";
+
and in the '''French/cust_text.php''' as
 +
<syntaxhighlight lang="php" enclose="div">
 +
$text['ancestorstory'] = "L'histoire de votre ancêtre";
 +
</syntaxhighlight>
  
 
=== edit log ===
 
=== edit log ===
You must also update line 18 (before deleting lines 2-4) for the log string
+
You must also update line 18 (in the file before lines 2-4 are removed) for the log string
  
<pre>
+
<syntaxhighlight lang="php" line start="18" enclose="div">
 
$logstring = "<a href=\"/path_to_your_history_folder/this_file_name\">Your Title Here</a>";
 
$logstring = "<a href=\"/path_to_your_history_folder/this_file_name\">Your Title Here</a>";
</pre>
+
</syntaxhighlight>
with the same text used for the tng_header function call and with the actual  
+
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,
 
path and name of the file you are creating.  For example,
  
<pre>
+
<syntaxhighlight lang="php" enclose="div">
$logstring = "<a href=\"/extrapgs/feature1.php\">Your Ancestor's Story</a>";
+
$logstring = "<a href=\"extrapgs/feature1.php\">Your Ancestor's Story</a>";
</pre>
+
</syntaxhighlight>
  
 
or as
 
or as
  
<pre>
+
<syntaxhighlight lang="php" enclose="div">
$logstring = "<a href=\"/extrapgs/feature1.php\">$text[ancestorstory]</a>";
+
$logstring = "<a href=\"extrapgs/feature1.php\">$text['ancestorstory']</a>";
</pre>
+
</syntaxhighlight>
 
 
  
 
=== edit page content ===
 
=== edit page content ===
You must replace the following text in lines 30-33  
+
You must replace the following text in lines 30-33 (in the file before lines 2-4 are removed)
  
Your history goes here (do not include a BODY tag). IMPORTANT: In order for links on this page to work, you must edit your custom header, footer and
+
<syntaxhighlight lang="html4strict"  line start="2"line start="30" enclose="div">
meta files (see General Settings for their specific names) and make sure all file and internal link references are *absolute* and not relative.  
+
Your history goes here (do not include a BODY tag). IMPORTANT: In order for links on this page to work, you  
In other words, the default meta.html file contains a relative link to the style sheet "genstyle.css". To make it absolute, prefix that with the path
+
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.  
from your root folder (i.e., "/genealogy/genstyle.css").
+
In other words, the default ''meta.html'' file contains a relative link to the style sheet "genstyle.css". To  
 +
make it absolute, prefix that with the path from your root folder (i.e., "/genealogy/genstyle.css").
 +
</syntaxhighlight>
  
 
with your own text. For example, you could enter something like the following to add a Feature Story for Template 4.
 
with your own text. For example, you could enter something like the following to add a Feature Story for Template 4.
  
<nowiki>
+
<syntaxhighlight lang="html4strict"  enclose="div">
 
<p class="header">Feature 1 Story</p>
 
<p class="header">Feature 1 Story</p>
</nowiki>
+
</syntaxhighlight>
 +
 
 
This is the story of our first ancestor who came to Quebec (New France) from Joigny, France in June 1665   
 
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  
 
with the Carignan-Saliere Regiment which had been dispatched by the King of France  
Line 80: Line 108:
  
 
If you don't want the pull down menu on your user created page, you can remove  
 
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'''
+
the comments ( // ) at the beginning of '''line 26''' (in the file before lines 2-4 are removed)
<pre>
+
<syntaxhighlight lang="php" line start="26" enclose="div">
 
//$flags[noicons] = true;
 
//$flags[noicons] = true;
</pre>
+
</syntaxhighlight>
  
 
=== add TNG icons ===
 
=== add TNG icons ===
Line 90: Line 118:
 
user-created page, you will need to add  
 
user-created page, you will need to add  
  
 +
<syntaxhighlight lang="php"  enclose="div">
 
<?php echo tng_coreicons(); ?>
 
<?php echo tng_coreicons(); ?>
 +
</syntaxhighlight>
  
 
after your header line for example
 
after your header line for example
<pre>
+
<syntaxhighlight lang="html4strict"  enclose="div">
 
<p class="header">Feature 1 Story</p>
 
<p class="header">Feature 1 Story</p>
 
<?php echo tng_coreicons(); ?>
 
<?php echo tng_coreicons(); ?>
 +
</syntaxhighlight>
 +
 +
=== 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:
 +
 +
<syntaxhighlight lang="php" line start="7" enclose="div">
 +
include( "begin.php");  //Nuke users must include "../../../begin.php" here
 +
if( !$cms['support'] )
 +
$cms['tngpath'] = "";
 +
</syntaxhighlight>
 +
 +
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:
 +
 +
<syntaxhighlight lang="php" line start="7" enclose="div">
 +
include( "../../begin.php");  //Nuke users must include "../../../begin.php" here
 +
if( !$cms['support'] )
 +
        $cms['tngpath'] = "../../";
 +
</syntaxhighlight>
 +
 +
 +
 +
'''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.
 +
<pre>
 +
//Nuke users must include "../../../begin.php" here
 
</pre>
 
</pre>
  
== extrapgs subfolder ==
 
  
Since the historytemplate.php is designed to be used in the histories
+
== Absolute Paths ==
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.
 
 
 
== absolute paths ==
 
  
 
The custom header, footer, and meta files should also be using absolute paths.   
 
The custom header, footer, and meta files should also be using absolute paths.   
  
Most of the templates for TNG 7.0 were updated to use '''$cms[tngpath]''' to provide the absolute path.
+
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 ==
 
== Extra Pages Document Download ==
See [http://www.tngforum.us/index.php?showtopic=2236&hl=extra+pages User Created Pages in TNG Forum] which   
+
See [https://tng.community/index.php?/forums/index.php?showtopic=2236&hl=extra+pages User Created Pages in TNG Forum] which   
provides a [http://www.tngforum.us/index.php?act=Attach&type=post&id=239 download the Word Document]  
+
provides a [https://tng.community/index.php?/forums/index.php?act=Attach&type=post&id=239 download the Word Document]  
 
that describes Dave Freeman's process used to create user pages
 
that describes Dave Freeman's process used to create user pages
 +
 +
== Related Links ==
 +
 +
[[User Pages - Multi-Language]]
 +
 +
ASCII editors:
 +
 +
* [[Notepad-plus-plus|Notepad++]]
 +
 +
* [[PSPad]]
 +
 +
* [[TextWrangler]] on the Mac
 +
 +
Coding Tips:
 +
 +
* [[Coding Rules]]
 +
* [[Coding Links in Pages]]
 +
* [[Media-Add Media to Extra Page]]
 +
* [[:Category:How to Code|How to Code]]
 +
 +
[[Category:Getting Started]]
 +
[[Category:How to Code]]

Revision as of 06:40, 21 November 2016

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

//Remove the following two lines before deploying copies of this file to the "histories" folder.
echo "Please remove this line and the \"exit\" line that follows before deploying this file to the \"histories\" folder.";
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

//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)

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

$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)

Your history goes here (do not include a BODY tag). IMPORTANT: In order for links on this page to work, you 
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. 
In other words, the default ''meta.html'' file contains a relative link to the style sheet "genstyle.css". To 
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)

//$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:

include( "begin.php");   //Nuke users must include "../../../begin.php" here
if( !$cms['support'] )
	$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:

include( "../../begin.php");   //Nuke users must include "../../../begin.php" here
if( !$cms['support'] )
        $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: