Genlib Functions
![]() |
The Genlib Functions provides brief descriptions of some of the TNG functions used to create a dynamic page. |
|
Genlib Functions describes the TNG functions in genlib.php that are called as TNG generates the different page displays using the information you defined in Setup >> Configuration >> General Settings >> Site Design using the parameters passed on the function call.
Header
The header function is called tng_header. It is invoked with two parameters
- the Text string to be used for the page title or $title variable
- flags variables that control the behavior of the function.
The tng_header function:
- generates the page heading
- creates the title, keywords, and description
- sets the charset
- includes the style sheets
- includes the custom header
- warns the user the site is in maintenance mode
TNG generates the required <!DOCTYPE to tell the browsers how to interpret the page. Starting with TNG 6.2 the doctype was changed to XHTML. With TNG 7.0 the doctype can be specified in the Site Design as an override if the default <!DOCTYPE causes problems.
TNG then generates the page title based on the $title variable passed on the tng_header function call to which it concatenates the $sitename if it was provided in the Setup >> Configuration >> General Settings >> Site Design Site Name. The $title is also echoed as a meta Keywords and Description in the html page <head>.
TNG then sets the charset based on the charset of the Language being used for the page. TNG defaults the charset to ISO-8859-1 during install. You can change it to UTF-8 by changing the charset assigned in Setup - Language.
TNG includes the link to tabs stylesheet, the custom meta, and custom header based on values provided in Setup >> Configuration >> General Settings >> Site Design for Tabs Style Sheet, Custom Meta, and Custom Header which get passed to the genlib functions using the $tabs, $custommeta, and $customheader variables respectively.
TNG add the copyright and version string to the page <head> section.
Includes the custom header
TNG includes the custom header that you defined in Setup >> Configuration >> General Settings >> Site Design Custom Header using the variable $customheader, if not printing the page and if the $flags['noheader'] is false.
if( !$tngprint && !$flags[noheader] ) include( $customheader );
So in creating user-pages where you do not want to include the custom header, you could set the $flags['noheader'] = true; to suppress the inclusion of topmenu.php or the custom header you specified in Setup >> Configuration >> General Settings >> Site Design Custom Header input field.
Generates the <body>
TNG generates the <body> statement if the $flags['nobody'] is false.
elseif(!$flags['nobody']) echo "<body>\n";
So in creating user-pages where you may want to use a different <body> statement, you could set the $flags['nobody'] = true; to suppress the generation of the <body> statement by the tng_header function. Some of the templates use this approach.
The <body> statement is normally generated within the topmenu.php file in the appropriate template.
The tng_header function normally includes the topmenu.php file based on the Template Settings. See How TNG builds a page
TNG generates the pull down menu if the $flags['noicons'] is false.
if( !$flags['noicons'] ) echo tng_icons( 1 );
So in creating user-pages where you do not want the pull down menu, you could set the $flags['noicons'] = true; to suppress the generation of the pull down menu.
Generates Maintenance Message
The TNG header function generates the Maintenance Mode is ON message if in maintenance mode to alert visitors that you are currently doing site maintenance. See the Maintenance Mode article on how to set maintenance mode on and off and view examples of the messages displayed. When Maintenance Mode is ON, users are not able to access or update information on your web site. You as the site administrator will still have access to all portions of your web site.
The footer function is called tng_footer and it:
- includes the custom footer
- echoes the $flags if set
- includes the Google Map javascript
- includes the end.php
TNG includes the custom footer specified in the Setup >> Configuration >> General Settings >> Site Design Custom Footer field.
If the map[key] is set based on the Mapsettings, TNG generates the javascript to load the Google Maps API as part of the footer, so that the page will be completely built before the Google Maps API is invoked.
Menu
Two separate menu functions are part of genlib.php, the pull down menu and the Home page navigation and other links.
The tng_icons function generates
- the pull down menu
- the dynamic language pull down
You can set the position of the pull down menu in Setup >> Configuration >> General Settings >> Site Design Menu Location where you can specify to put the menu on the right side or left side of the page, or not to display it all.
Note that if you allow dynamic language switching and have more than one language specified, the language pull down will continue to be displayed.
Suppressing pull down on Home page
Also if you are using a template that uses topmenu.php for formatting the banner and menu options, such as templates 6 and 8, then you should be able to suppress the display of the pull down menu on your home page by add the following to your index.php
$flags[noicons] = true;
just before the tng_header( ) function call.
TNG V9
In TNG V9, the tng_coreicons function is obsolete and the icon links are now part of the TNG pull down menu function. The links are generated based on the settings in Setup >> Configuration >> General Settings >> Site Design for each of the following links
- Home
- Search
- Login
- Bookmark
- Share (generates a Share link that when expanded links to social media sites - Facebook, Tweeter, and Google+)
If you set individual items to
|
TNG V8
The tng_coreicons function generates the links based on the settings in Setup >> Configuration >> General Settings >> Site Design for each of the following links
- Home
- Search
- Login
- Bookmark
If you set individual items to
|
when you invoke the tng_coreicons() function.
tng_coreicons
TNG version: | ≤ 8.1.3 |
TNG version: | ≥ 6.0 |
You can add the Home Page navigation links to your user-created pages by coding
<?php echo tng_coreicons($instance): ?>
TNG version: | ≥ 9.0 |
Note that the tng_coreicons function is obsolete with TNG V9, since the core icons are now part of the TNG menu line.