Jump to content
TNG Community

infomenulinks issue [Solved]


John Paul

Recommended Posts

Good morning all.  I seem to have an issue moving a couple of menu items from the More menu to the Info menu using customconfig.php.  It looks like I have all the syntax correct in customconfig, and both cust_text.php files.  But as seen in the attachment, I'm getting duplicate labels for Data Protection...it should be Data Protection and FAQs and Help.

Maybe a second pair of eyes would help?

Just wanted to add that the links to them are correct.  go to my site in the signature and you'll see what I mean.  Also the screenshot for cust_text.php applies to both English and English UTF8.

 

infodropdown.jpg

customconfig.jpg

cust_text.jpg

Link to comment
Share on other sites

I never and have never edit genlib.php.  And there is nothing in my genlib.php that even looks like that.  What you're showing me is from your firefox inspector.  I see that too.  But I can't figure out how to edit that.  It worked correctly when it's a $custommenulink, but this is what get when I switch it to a $infomenulink......

Link to comment
Share on other sites

Sorry for my inadequate explanation. You are correct my screen capture was from Firefox. Here is the way it appears in Microsoft Edge:

image.png

The inspect and view page source are the only ways I have to check the HTML for a remote web page. The custom menu is called from the genlib function tng_getInfoMenu().  The last part of the menu contains the code below:
 

    global $infomenulinks;

    if( isset( $infomenulinks ) ) {
        $menu = array_merge($menu,custom_links( $infomenulinks ));
    }

    return $menu;
}

This section merges the custom links in customconfig.php with the $menu array. It is difficult to figure out the issue on your site without seeing the code, so I created two links on my test site using template 21 as shown below.

image.png

Here is the code I added to customconfig.php. (Note I used suggest.php to test the FAQs and Help link since I do not have a php file for that)

I included the icon line even though I don't have an icon for those links. The icon lines can be deleted if you do not have icon images for these links.
 

$link_nr = 0;
$infomenulinks[$link_nr]['target'] = "data_protection_policy.php";
$infomenulinks[$link_nr]['icon'] = "path/image.type";
$infomenulinks[$link_nr]['label_text'] = "Data Protection";

$link_nr++;
$infomenulinks[$link_nr]['target'] = "suggest.php";
$infomenulinks[$link_nr]['icon'] = "path/image.type";
$infomenulinks[$link_nr]['label_text'] = "FAQs and Help";

 

Hopefully you can find the differences are so your links display correctly.

Link to comment
Share on other sites

5 hours ago, Steve1200 said:
$infomenulinks[$link_nr]['label_text'] = "FAQs and Help";

This last line in my customconfig.php was link this:
$informenulinks[   ].....   Notice the r where I misspelled it?  Removed the r and of course now it works as it should.  Dam I hate getting old, my attention to detail isn't what it used to be.  Man I don't know how many times I went over this little bit of code and just didn't see it misspelled.

Steve1200, thanks for being such great help and my extra set of eyes.

I'll mark this as solved.

Link to comment
Share on other sites

  • John Paul changed the title to infomenulinks issue [Solved]
  • 4 weeks later...
Philip Roy

Is there a way to add code to determine where in the menu order these new menu items appears? For example, this discussion adds "Data Protection" and "FAQs and Help" to the bottom of the Info menu...but what if you wanted them to go after Repositories and before DNA and Contact Us (for example)?

I've been scouring the forums and also the page on a custom menu hook, but I can't see how you can determine menu order.

Link to comment
Share on other sites

Rob Severijns
10 hours ago, Philip Roy said:

I've been scouring the forums and also the page on a custom menu hook, but I can't see how you can determine menu order.

As far as I know you can change the order in genlib.php

Beware though that many mods make changes to this file so make sure you have a backup and after a TNG update genlib.php will most likely be replaced so document your changes well.

Link to comment
Share on other sites

I looked at the code this morning. Since this code is in genlib.php a lot of mods modify the file.

I created a mod to move info custom links above the DNA link that should minimize conflicts with any other mods.

Please let me know if you have any issues.

image.png

 

Added mod to WIKI page Move Custom Info Menu Links v13.0.3.2

 

Link to comment
Share on other sites

You can change the anchor for location 1 in the cfg file and move the custom links up or down in the menu. However, links in customconfig.php are always shown as a group and in the same order they appear in the customconfig.php file.

Link to comment
Share on other sites

Philip Roy

I'm getting a bit confused.

* I had tried changing customconfig.php, but it sounds like you are saying that you can't determine where a menu item is placed by using that approach? They just get added to the end of the menu and therefore is not the approach to use?

* The mod you provided references a wiki page that I can't find "Move Custom Info Menu Links"?

* I feel like the mod you just posted is an addition to using another mod of some sort but I can't find any called "Custom Info Menu Links Mod"?

Sorry...I didn't realise that customising menus in TNG was going to be so complex.

Link to comment
Share on other sites

Sorry for any confusion, I'll try to explain more clearly. In genlib.php TNG has a function tng_getInfoMenu where standard info menu items are created. Near the end of that function is some code to load links contained in customconfig.php which are then appended to the end of the info menu array using array_merge. So It doesn't matter what you do in customconfig.php because the array_merge command appends to the end of the existing menu array.

You can change the order of links within the customconfig.php by changing their order in the file but this has no effect with regard to positioning in the tng_getInfoMenu function menu.

Since PHP constructs pages in the order the commands are executed, and the customconfig links are appended to the end of the info menu, the only way to change that behavior is change the point where customconfig links are inserted.

You could manually move the code but if another mod is using any of the code for an anchor, there would be a conflict. Plus manual changes are lost during upgrades. So I created a mod which leaves the code in place but changes the order of execution so the customconfig links appear after repositories in the info menu. My comment about the mod's anchor location 1 is that is the only change needed to move the customconfig links group up or down within the info menu.

I created that mod today and did not post posted Move Custom Info Menu Links mod on the WIKI. because I did not have time plus no one else has tested it or left any comments, good or bad. If it does what you want, without conflicts, I can probably add it to the WIKI tomorrow, if I don't work to late.

Edited by Steve1200
Added Mod to WIKI
Link to comment
Share on other sites

Philip Roy

Thanks for all your help on this! I got things working on my local version of TNG, so I am happy. Really appreciate the advice/support...and the shout out of my name in the wiki page credits 😁 Thanks again!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...