John Paul Posted April 27, 2024 Report Share Posted April 27, 2024 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. Quote Link to comment Share on other sites More sharing options...
Steve1200 Posted April 27, 2024 Report Share Posted April 27, 2024 I looked at your page and found the following: I appears you used the same text for both links in genlib.php. Quote Link to comment Share on other sites More sharing options...
John Paul Posted April 27, 2024 Author Report Share Posted April 27, 2024 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...... Quote Link to comment Share on other sites More sharing options...
Steve1200 Posted April 28, 2024 Report Share Posted April 28, 2024 Sorry for my inadequate explanation. You are correct my screen capture was from Firefox. Here is the way it appears in Microsoft Edge: 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. 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. Quote Link to comment Share on other sites More sharing options...
John Paul Posted April 28, 2024 Author Report Share Posted April 28, 2024 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. Quote Link to comment Share on other sites More sharing options...
Steve1200 Posted April 28, 2024 Report Share Posted April 28, 2024 Glad you found the issue! I'm almost 70 and am very familiar with typos that I too have difficulty finding at times. Quote Link to comment Share on other sites More sharing options...
Philip Roy Posted May 27, 2024 Report Share Posted May 27, 2024 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. Quote Link to comment Share on other sites More sharing options...
Rob Severijns Posted May 27, 2024 Report Share Posted May 27, 2024 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. Quote Link to comment Share on other sites More sharing options...
Steve1200 Posted May 27, 2024 Report Share Posted May 27, 2024 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. Added mod to WIKI page Move Custom Info Menu Links v13.0.3.2 Quote Link to comment Share on other sites More sharing options...
Steve1200 Posted May 27, 2024 Report Share Posted May 27, 2024 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. Quote Link to comment Share on other sites More sharing options...
Philip Roy Posted May 27, 2024 Report Share Posted May 27, 2024 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. Quote Link to comment Share on other sites More sharing options...
Steve1200 Posted May 28, 2024 Report Share Posted May 28, 2024 (edited) 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 May 29, 2024 by Steve1200 Added Mod to WIKI Quote Link to comment Share on other sites More sharing options...
Philip Roy Posted May 30, 2024 Report Share Posted May 30, 2024 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! Quote Link to comment Share on other sites More sharing options...
Steve1200 Posted May 30, 2024 Report Share Posted May 30, 2024 No problem! It was your idea, I only created the mod. (Which I'm using as well) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.