Menu Bar Link Mod for TNG

steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Menu Bar Link Mod for TNG

Post by steven »

When using TNG with WordPress all has gone reasonably well except for mobile devices. There is no easy way to get back to WordPress from TNG pages without using the back button or typing in the URL again. So I created a MOD that adds a URL link in the TNG inner menu bar. After thinking about it users might want a link for other reasons, like linking to a blog, so I changed the MOD and added modes of operation. This MOD can be used with or without a CMS (Content Management System - WordPress, joomla etc.). The first version of Menu Bar Link was rather clunky so it was rewritten.

TNG provides a way to add pull down menus where you can add links. If you are looking for a pull down menu check out Add Links to TNG. This MOD adds one link while pull down menus support multiple links.
 
In Mode 0 the left home button function remains unchanged and links to TNG while the new button displays CMS, by default, and will link to any clean URL specified in the MOD's Edit Options menu.
 
--- MODE 0 Display ---

Image

In Mode 1 the left home button links to a URL, specified in the mod options, while the new button links to TNG. The default text displays TNG.
 
--- MODE 1 Display ---

Image

So if you use WordPress for your home page, you can select mode 1, and enter a clean URL for WordPress. When users select Home the WordPress page will be loaded. If they select the new button, the TNG page will be loaded.

You can change the text that is displayed depending on which mode you use. For example in Mode 0 you can change the text for the URL link but not the home page link.
 
--- MODE 0 Display ---

Image

In Mode 1 you can change the text for the TNG link but cannot change text for the home page URL link text since it becomes your home page.
 
--- MODE 1 Display ---

Image

The screen shot below shows the mobile menu, for my website, on an iPhone. Mobile devices were the primary reason for creating the mod.

--- MODE 1 Display on iPhone ---


Image

The MOD includes a menubartext.php file, located in the current extensions folder. You do not need to edit the cust_text.php for any installed languages. The text file allows admins to change the text displayed in the menu without causing a partially installed message in mod manager. All standard TNG languages are included.
After the mod is installed go to the extensions folder and edit the menubartext.php file. Edit either CMS or TNG text for your language using Komodo IDE, Notepad++ or a similar editor that does not add a BOM (Byte Order Mark) character to the file. Text is enclosed in single quotes and the line must end with a semicolon. If you make a mistake, you may get a php error which could prevent TNG from loading. If this happens go the the extensions folder and delete the menubartext.php file. When you return to Mod Manager it will say Partially Installed. Select Clean Up and reinstall the mod.

You can delete any languages you are not going to use. If you uninstall the MOD the menubartext.php file is NOT deleted from the extensions folder. If you decide to remove the MOD you will need to delete the menubartext.php file in the extensions folder.

The MOD can be used regardless of the TNG installation configuration. It doesn't matter if TNG and WordPress are in separate folders or if TNG is installed in the WordPress folder. No integration between TNG and WordPress is required but if the two are integrated the MOD should install and run without issue provided there are no additional modifications, by other MODs, that prevents installation.

When when using one domain name and placing TNG and CMS files in separate folders, both folders are placed in the root or root folder if you have virtual hosts. Create an index file, in the root or root folder, that points to the program you want to use for the home page.

For example if WordPress is the home page use the code below: (change the wp folder name to the correct name)

Code: Select all

<?php
define( 'WP_USE_THEMES', true );

require __DIR__ . '/wp/wp-blog-header.php' );
If you are using TNG for the home page use the code below: (change the domain_name and tng folder name to the correct names)

Code: Select all

<?php
header("Location: http://domain_name/tng/index.php");
?>
Keep in mind if you have an established TNG website, this will break existing links and bookmarks because the TNG folder name is added to the URL. If you are using Apache, create a rewrite rule that redirects existing links to the new TNG folder.


Some TNG templates do not display the inner menu bar on the index page. If you want to display the menu bar open the index.php file, for the template you are using, and change $flags['noicons'] from true to false.

When the mod is first installed the additional icon will be the bookmark icon, simply refresh the page to reload the icons.

menubar_link_v13.0.3.4.zip

Mod revisions - Updated for v13 and v14
TNG WIKI download link

menubar_link_v13.0.3.3.zip

For TNG Version 12.3.0
menubar_link_v12.3.0.2.zip


* The mod does not install in v13.0 because the anchor text is missing in Croatian-UFT8 customtext.php. Update the languages or use Notepad++ or a similar editor place the code below on the second line, after <?php, and the mod will install.

Code: Select all

//Mods should put their changes before this line, local changes should come after it.



Obsolete Versions

menubar_link_v12.0.0.1.zip
(3.1 KiB) Downloaded 120 times
You do not have the required permissions to view the files attached to this post.
Last edited by steven on Sat Sep 26, 2020 9:15 am, edited 7 times in total.