Jump to content
TNG Community

Additional Dropdown menu / genlib mod


LR Majercin

Recommended Posts

LR Majercin

NOTE: This top post was reedited on 21 Mar 2007. It corrects original errors, and all the discussion that follows this top post in this thread. Larry

I added an additional dropdown menu (using template 2), TNG version 6.0.4.

Additional support was greatfully contributed by Ken Roy and Roger Moffat.

In order to create an additional dropdown menu, you will need to make changes to the genlib.php file and create additional text in the English/cust_text.php file.

You may also choose to create new custom icons. These .gif files will need to reside on your main genealogy folder.

Please make a backup of these files before making any changes.

The lines referenced refer to an unaltered genlib file. Your lines may vary if you have made previous changes. Lines will be referenced in greatest to least fashion to keep the line numbers as true as possible.

Red text references code links to the English/cust_text.php file. Add your own custom text. These codes will put the text on your new links.

Blue text references URL links. Change these to your URL links.

Green text references icon links. Either reference existing TNG icons, or create your own (20x20 pixels). Feel free to copy mine at http://www.majercin.com/surnames.php .

In genlib.php:

1. After (about line 496):

border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[contactus]</a></li>\n";
   $menu .= "</ul>\n";
   $menu .= "</li>\n";
and before the trailing "}" add the following (make sure to change the colored text): $menu .= "<li><a href=\"#\"><img src=\"$cms[tngpath]" . "ArrowDown.gif\" width=\"25\" height=\"8\" vspace=\"4\" border=\"0\" align=\"left\" alt=\"\" />$text[mgr_extras]</a>\n"; $menu .= "<ul id=\"fourth\">\n"; $menu .= "<li><a href=\"/phpbb/viewforum.php?f=1\"><img src=\"$cms[tngpath]mgr_faq.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[mgr_faq]</a></li>\n"; $menu .= "<li><a href=\"/phpbb/index.php\"><img src=\"$cms[tngpath]mgr_forum.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[mgr_forum]</a></li>\n"; $menu .= "<li><a href=\"/cpg144/index.php\"><img src=\"$cms[tngpath]mgr_famphoto.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[mgr_famphoto]</a></li>\n"; $menu .= "<li><a href=\"Obits.html\"><img src=\"$cms[tngpath]tng_hs.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[mgr_obit]</a></li>\n"; $menu .= "<li><a href=\"databases.html\"><img src=\"$cms[tngpath]tng_admin.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[mgr_data]</a></li>\n"; $menu .= "<li><a href=\"fam_links.html\"><img src=\"$cms[tngpath]tng_names.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[mgr_famlink]</a></li>\n"; $menu .= "<li><a href=\"spanlinks.html\"><img src=\"$cms[tngpath]mgr_span.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[mgr_span]</a></li>\n"; $menu .= "<li><a href=\"slavlinks.html\"><img src=\"$cms[tngpath]mgr_slav.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[mgr_slav]</a></li>\n"; $menu .= "</ul>\n"; $menu .= "</li>\n"; 2. On line 442: Change:
$menu .= "<table$iconalign width=\"400\">\n";
to:
$menu .= "<table$iconalign width=\"410\">\n";
This allows the newly created menu to stay on the same line in Firefox and Safari browsers. 3. Change line 53 from:
echo "<style type=\"text/css\">#mnav li:hover #third, #mnav li.sfhover #third {left: 130px;}</style>\n";
to:
echo "<style type=\"text/css\">#mnav li:hover #fourth, #mnav li.sfhover #fourth {left: 228px;}</style>\n";
This creates the shift for the dropdown menus. The increase in pixels allows the dropdowns to align in IE 7. There is still a bit of an offset in Firefox. Depending on your preference you can increase this to about 236px if you want it to align in Firefox or Safari. Save and close genlib.php
IN English\cust_text.php: Create your own custom text specific to your new links. Here's mine:
$text[mgr_extras] = "Extras";
$text[mgr_faq] = "F.A.Q.";
$text[mgr_forum] = "Forum";
$text[mgr_famphoto] = "Family Photos";
$text[mgr_obit] = "Obituaries";
$text[mgr_slav] = "Slavic Links";
$text[mgr_span] = "Spanish Links";
$text[mgr_data] = "Databases";

Here's a link to an example:

http://www.majercin.com/surnames.php

Hope this can be of use to some of you.

Regards,

Larry

Edited by LR Majercin
Link to comment
Share on other sites

Looking at that page in Safari on Mac OS X, the 4th menu is always wrapped under the first one, no matter how wide I make that page. Is that the intention or should it have been 4 in a row?

Roger

Link to comment
Share on other sites

Doggone!

I added a menu to allow users to do context directed research on other internet sites and never could get the fourth dropdown to sit right, so I had to redistribute the items from the original three dropdowns to get a free position for the Research dropdown... I completely missed the 'hover' code floating up at the top. Thanks!

...but I note from Roger's post there may still be some Safari problems...

everything looks good to me on IE.

Persevere!

Jerry

Link to comment
Share on other sites

Doggone!

I added a menu to allow users to do context directed research on other internet sites and never could get the fourth dropdown to sit right, so I had to redistribute the items from the original three dropdowns to get a free position for the Research dropdown... I completely missed the 'hover' code floating up at the top. Thanks!

...but I note from Roger's post there may still be some Safari problems...

everything looks good to me on IE.

Persevere!

Jerry

On Firefox 2.0.2 it looks the same, with the 4th menu wrapped under the first one. Also, when you hover over the "Extra" menu, the drop down list is way off to the right to the point that I can't ever click on any of the items. I have the screen set at 1024 x 768.

Link to comment
Share on other sites

LR Majercin

Looking at that page in Safari on Mac OS X, the 4th menu is always wrapped under the first one,

Roger, I forgot to think about Safari when builiding this, and didn't see what you described until I tried it on a Mac at work this morning. Oh, well... back to the drawing board.

Thanks all for the second set of eyes.

Larry

Link to comment
Share on other sites

Roger, I forgot to think about Safari when builiding this, and didn't see what you described until I tried it on a Mac at work this morning. Oh, well... back to the drawing board.

Thanks all for the second set of eyes.

It's the same in Firefox on the Mac too. I think you need to alter the width of the table that encloses those 4 menus, and see if you can move the starting point for it to the left a bit too?

Roger

Link to comment
Share on other sites

LR Majercin

think you need to alter the width of the table that encloses those 4 menus, and see if you can move the starting point for it to the left a bit too?

Roger

Thanks Roger. It appears that the Win and Mac version of Firefox, and Safari are all doing the same thing.

If someone could point me to the area where this table is defined/created, I'd really appreciate it.

I have been pouring through genlib.php, genstyle.css and tngmenuhover.js, thinking that one of these three files has the answer.

There are many references to "mnav" in genlib.php. This is the css definitions for the dropdown menu.

Thanks again to all

Link to comment
Share on other sites

Thanks Roger. It appears that the Win and Mac version of Firefox, and Safari are all doing the same thing.

If someone could point me to the area where this table is defined/created, I'd really appreciate it.

I have been pouring through genlib.php, genstyle.css and tngmenuhover.js, thinking that one of these three files has the answer.

There are many references to "mnav" in genlib.php. This is the css definitions for the dropdown menu.

Thanks again to all

Take a look at

http://roger.lisaandroger.com/Majercin.html

The "fix" is to change line 453 in genlib.php.

            $menu .= "<table$iconalign width=\"400\">\n";

To get 4 menus to stay on one line you need at least 405 for the value in that line it seems.

Roger

Link to comment
Share on other sites

Take a look at

http://roger.lisaandroger.com/Majercin.html

The "fix" is to change line 453 in genlib.php.

            $menu .= "<table$iconalign width=\"400\">\n";

To get 4 menus to stay on one line you need at least 405 for the value in that line it seems.

Roger

I had to use at least 410 in order to get 4 menu columns on the same line. I am still struggling with the language pull down which now has a background and appears to become part of the 4th column although on a second line. Does anyone know how to eliminate the background on the language pulldown? (The code is currently not on my public site, but only on my local web server.)

Link to comment
Share on other sites

I have moved the code to my site, so if anyone can tell me how to separate the language selection from the 4th menu, I would appreciate it.

Link to comment
Share on other sites

I have moved the code to my site, so if anyone can tell me how to separate the language selection from the 4th menu, I would appreciate it.

The problem is that you haven't closed the <td> and<tr> tag that starts that navigation menus until after the language pop up.

Take a look at

http://roger.lisaandroger.com/KenRoy.html

in the source code to see what I changed to get it to work (after Frenchville I've added

</ul></div></td></tr><tr><td>

(well Dreamweaver added some of them).

Then you should be able figure out just what to change in your files to achieve that.

Roger

Link to comment
Share on other sites

The problem is that you haven't closed the <td> and<tr> tag that starts that navigation menus until after the language pop up.

Take a look at

http://roger.lisaandroger.com/KenRoy.html

in the source code to see what I changed to get it to work (after Frenchville I've added

</ul></div></td></tr><tr><td>

(well Dreamweaver added some of them).

Then you should be able figure out just what to change in your files to achieve that.

Roger

Thanks Roger,

Actually, the code in genlib.php does the closing of the <td> and <tr>, but in order for that to work, you have to modify the

if( $tngconfig[menu] < 2
elseif( $tngconfig[menu] < 2 || $chooselang )
if( $tngconfig[menu] == 2 && $chooselang )
if( $tngconfig[menu] < 2 )
if( $tngconfig[menu] < 2 && !$iconalign )
to add 1 to all occurences, so 2 becomes 3. I also had forgotton to add the
            $menu .= "<ul id=\"fourth\">\n";
before the Site pulldown menu. The first occurence of $menu .= "<table$iconalign width=\"400\">\n" was changed to
$menu .= "<table$iconalign width=\"410\">\n";;
and the second occurence to
$menu .= "<table$iconalign width=\"505\">\n";;
The second occurence controls the menu when left align above the page heading line. The echo "<style type=\"text/css\">#mnav li:hover #fourth, #mnav li.sfhover #fourth {left: 130px;}</style>\n"; was changed to
            echo "<style type=\"text/css\">#mnav li:hover #fourth, #mnav li.sfhover #fourth {left: 160px;}</style>\n";

.

to allow the 4th menu not to cover the language pulldown when right aligned.

The only issue is when you switch to French (Francais) the language pulldown drops one line, but it was that way before.

Link to comment
Share on other sites

Something is still wrong - it wraps in Safari, even if I make the window 1680 pixels wide.

Roger

Works OK in Mozilla and FireFox. Doesn't even display the 4th menu in IE 6. So maybe if I figure out what causes the IE problem, it will fix the Safari one, since I don't have a MAC to test on. Thanks for looking at it.

Link to comment
Share on other sites

Works OK in Mozilla and FireFox. Doesn't even display the 4th menu in IE 6. So maybe if I figure out what causes the IE problem, it will fix the Safari one, since I don't have a MAC to test on. Thanks for looking at it.

OK, I removed one of the

$menu .= "<ul id=\"fourth\">\n";

which appears to have fixed the problem in IE 6. Let me know if it is OK in Safari.

Link to comment
Share on other sites

Works OK in Mozilla and FireFox. Doesn't even display the 4th menu in IE 6. So maybe if I figure out what causes the IE problem, it will fix the Safari one, since I don't have a MAC to test on. Thanks for looking at it.

Take a look at Larry's page - that works fine, including appearing "correctly" in Dreamweaver without any changes needed, so whatever differences you see probably are the answer - although his site didn't have language changing, and that's where it's going wrong.

Roger

Link to comment
Share on other sites

LR Majercin

Roger and Ken,

Thanks for the input and work. I was entering a smaller value for that table width, thinking that it would shift it left. You set me in the right direction.

There still seems to be an offset on the dropdown shift between IE and Firefox. I'm keeping the shift to align correctly with IE, since that seems to be what most users have. Thanks again for your efforts.

I will try to compile your input and possibly re-edit the first entry of this thread, so that other TNG'ers will be able to see the correct code on the first entry.

Larry

Link to comment
Share on other sites

Roger and Ken,

Thanks for the input and work. I was entering a smaller value for that table width, thinking that it would shift it left. You set me in the right direction.

There still seems to be an offset on the dropdown shift between IE and Firefox. I'm keeping the shift to align correctly with IE, since that seems to be what most users have. Thanks again for your efforts.

I will try to compile your input and possibly re-edit the first entry of this thread, so that other TNG'ers will be able to see the correct code on the first entry.

Larry

Hi Larry,

While your code appears to display OK in IE 6 and 7. it does not display correctly in Mozilla 1.7.5 and 1.7.13, nor FireFox 1.5.0.11 and FireFox 2.0.0.2. Your Extras menu is on the second line and the pull down list is to far to the right of the screen to allowing clicking on the links. I believe I used an offset of 160px for the displays to work in all the browsers listed.

Link to comment
Share on other sites

LR Majercin

While your code appears to display OK in IE 6 and 7. it does not display correctly in Mozilla 1.7.5 and 1.7.13, nor FireFox 1.5.0.11 and FireFox 2.0.0.2. Your Extras menu is on the second line and the pull down list is to far to the right of the screen to allowing clicking on the links. I believe I used an offset of 160px for the displays to work in all the browsers listed.

Ken Roy,

I had not updated my page by the time you wrote your reply.

Take a look at this link: http://www.majercin.com/surnames.php . I've checked it in IE 7.0.5730, IE 6.2 and Firefox 2.0.0.3. These are the only browsers I have to reference. I'll still need to see it in Safari, tomorrow.

Thanks, Larry

Link to comment
Share on other sites

Ken Roy,

I had not updated my page by the time you wrote your reply.

Take a look at this link: http://www.majercin.com/surnames.php . I've checked it in IE 7.0.5730, IE 6.2 and Firefox 2.0.0.3. These are the only browsers I have to reference. I'll still need to see it in Safari, tomorrow.

It looks fine in Safari and Firefox - both the latest version in Mac OS X

Roger

Link to comment
Share on other sites

LR Majercin

It looks fine in Safari and Firefox - both the latest version in Mac OS X

Roger

Thanks Roger!!! Does this settle the issue??? Whad'ya think? If so, I'll re-edit the first post with the corrections.

Larry

Link to comment
Share on other sites

Larry,

Thanks for sharing your code. Your page looks good in Mozilla and FireFox now.

For those of you who are using dynamic language switching, I believe you also need to change

the checks for $tngconfig[menu] from 2 to 3 
for the language selection pulldown to be position correctly. For those of you who are using Menu Location: Top Left, Over Heading, you also need to
change the second table width from 400 to 505

Roger,

Thanks for your help in debugging my code for Safari, which turns out was also an issue in IE.

Link to comment
Share on other sites

  • 4 months later...

To LR Majercin,

You did a wonderfull job in explaning how to make a Additional dropdown menu.

I visited your website, and what I find there, was exactly what I was searching for. I want to have this.

So I followed the instruction given in your last forum-contribution of Mar 20 2007.

I was disappointed to found that it dit not work well at my website.

Some information

I have updated TNG to version 6.1.1.

I changed genlib.php and English/cust_text.php as told in the instruction. I updated the files.

I do not see titles in the Menu at all.. I hoped to see your Menu with your titles and change it later into my own titles. I went to my surname list and clicked a link to a person, but I got a not working person page. The usual horizontal menu with personal information/ ancestors/descendants/relationship ans so on, did not appear.

I went back to the former good working website as I do not want the visitors of my website to find it not working.

I hope to get some advise in how to manage/solve the problem. I could send you the modified genlib.php-file and the cust-text.php file. If you want more information, let me know.

Please, help me.

Link to comment
Share on other sites

To LR Majercin,

Some information

I have updated TNG to version 6.1.1.

I changed genlib.php and English/cust_text.php as told in the instruction. I updated the files.

I do not see titles in the Menu at all.. I hoped to see your Menu with your titles and change it later into my own titles. I went to my surname list and clicked a link to a person, but I got a not working person page. The usual horizontal menu with personal information/ ancestors/descendants/relationship ans so on, did not appear.

I went back to the former good working website as I do not want the visitors of my website to find it not working.

Please, help me.

Frans,

Thank you for the kind words. Most of the thanks go to Ken Roy and the others who are far more savvy at this than I.

As you read in the forum message, this was created in version 6.0.4. I have upgraded to 6.1.0, but have not yet upgraded to 6.1.1.

The first post in this thread was edited to correct all the errors that we were getting when putting this together. If you'd like to send me a copy of your genlib.php file, I'd be happy to take a look at it and try it out.

I will send you an email directly that you can reply to.

Best Regards,

Larry Majercin

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...