Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:02
Menu works on one page, but not on another in same template?
Poster: Rebes
Dated: Wednesday June 28 2006 - 22:30:14 BST
Hello,
I'm running Wordpress with the Wordpress Gallery 2 plugin... I've successfully got the Milonic menu running, and it works great, at:
http://blog.dfx.org
If I go into the gallery, by clicking on Photos at the top (and not one of the submenu items):
http://blog.dfx.org/wp-gallery2.php
The menu works fine...
If I click into one of the subalbums (Either through the menu or from the gallery):
http://blog.dfx.org/v/house/
The Milonic menu disappears. Since the javascript code is embedded within the header of the wordpress theme, directly after the body tag, it always gets inserted, and always in the same place... If I view source on both of the above pages, and save the header up until just after the Milonic code, and run a compare on them, they only differ in places where they are supposed to (random image loader, and page load time).
Does anyone have any idea why it's not showing up once I get into a subalbum in the gallery?
Thanks much,
Dallas
Poster: John
Dated: Wednesday June 28 2006 - 23:51:48 BST
It's most likely your pathing. Instead of using milonic/milonic_src.js, etc, try /milonic/milonic_src.js (note the leading /). Do this for each of the 3 Milonic files.
You might also consider preloading the images in your menu. See the first item at http://www.milonic.com/menumodules.php.
Poster: Rebes
Dated: Thursday June 29 2006 - 1:03:53 BST
Good call John!
I fixed the pathing both in the header javascript calls (which fixed it showing up) and then in the menu_data file to fix the path of the images in the menu...
I already had the image preloader in there, but didn't have the correct path... fixed
Thanks for your help John!
Dallas
Poster: Rebes
Dated: Thursday June 29 2006 - 1:07:23 BST
Here's another question... my page centers itself depending on what resolution you are using, and the actual width of the content is fixed at just under 800 wide... So on higher resolutions, there is a large gap on both sides... I've offset the main menu from the left by a certain specific amount to make it fit at my laptops native resolution (1440x900) only to later discover that at lower resolutions (800x600) the menu is pushed farther over to the right... I'd like for it to start right below where the header image is, aligned more or less with the left edge of it... Is there some way to do this and have it still look good in all browsers?
Thanks in advance,
Dallas
Poster: Ruth
Dated: Thursday June 29 2006 - 6:28:52 BST
Hi,
You could try using screenposition="center"; and then set a negative offset, like left="offset=-30"; or whatever. But, since you have the site set to center no matter the resolution, I'd be setting the menu as screenposition="center"; it would then also always be in the same place no matter the resolution.
Ruth
Poster: Rebes
Dated: Thursday June 29 2006 - 14:17:27 BST
Hey Ruth,
Thanks for the reply! Your suggestion of using the left offset works perfectly...
I actually prefer it offset to the left, just because it lines up better with other menu systems on the site (Like the gallery breadcrumbs)...
I may change it if I decide to add a login link to the right side of the menu, spaced way out so it sits at the right edge, while the rest of the stuff would be on the left...
Is there an easy way to insert a bunch of blank space into the menu?
Dallas
Poster: Ruth
Dated: Thursday June 29 2006 - 15:46:51 BST
Hi,
Nope. We have had a number of people try different things. However, perhaps you want to make that login a separate menu. You can have more than one visible menu
So for example, you could make two main menus, naming them main and mainlog or something like that. Then you could set the main with the screenposition="center";left="offset=-whatever";alwaysvisible=1 etc. Then for the mainlog you would set it as alwaysvisible and screenposition="right";
They would both have the same top position set of course so they would both be at the same place vertically.
Alternatively, you could set another aI string after the last item, and before the login and use an image, say a blank.gif which is placed in the menu using regular html tags and sizes width=300 height=1. The problem with something like that is that as resolution changes that width would always be the same 300px and I don't know that this would serve you for positioning that login item.
Ruth
Poster: Rebes
Dated: Thursday June 29 2006 - 16:56:50 BST
Ruth, Thanks a lot!
Both of those method would work in my case... Setting an offset from the center to the right on a new menu would work (and is probably the better way)... The other one would work because the content of my page is fixed width.
One last question (I know, I'm getting annoying )... Does anyone familiar with wordpress know how I can check to see if the user is logged in, and display one login menu in one case, and another in another case? Is this something ... (scratch that, bright light just went on, and I know how to do it! )
Thanks for all your help, I REALLY appreciate it!!!
Dallas
Poster: Ruth
Dated: Thursday June 29 2006 - 18:12:09 BST
Hi,
Would you consider sharing how you're going to do it, in case anyone else might need something like that?
Ruth
Poster: Rebes
Dated: Thursday June 29 2006 - 20:35:26 BST
Sure, I've already implemented it at the above site...
I did in fact make a second menu... Actually, 3 more menus. I put each one in their own file, menu_data_admin.js, menu_data_registered.js and menu_data_unregistered.js.
I then used the following code in the header file (header.php):
Code:
<script type="text/javascript" src="/milonic/menu_data.js"></script>
<?php
if ( current_user_can('edit_posts') ) {
echo "<script type=\"text/javascript\" src=\"/milonic/menu_data_admin.js\"></script>";
} else if ( current_user_can('read') ) {
echo "<script type=\"text/javascript\" src=\"/milonic/menu_data_registered.js\"></script>";
} else {
echo "<script type=\"text/javascript\" src=\"/milonic/menu_data_unregistered.js\"></script>";
}
?>
<?php
if ( current_user_can('edit_posts') ) {
echo "<script type=\"text/javascript\" src=\"/milonic/menu_data_admin.js\"></script>";
} else if ( current_user_can('read') ) {
echo "<script type=\"text/javascript\" src=\"/milonic/menu_data_registered.js\"></script>";
} else {
echo "<script type=\"text/javascript\" src=\"/milonic/menu_data_unregistered.js\"></script>";
}
?>
So you can see my menu_data.js, which contains all the menu style information and the left menu... Then I use current_user_can() to check and see if the user is an admin, registered, or unregistered. I write the appropriate menu_data_*.js into the page for whichever it is. The nice thing is, I don't have to repeat the menu styles in the other files, because I'm just using the same styles I used in the leftmost menu. I removed the drawMenus() from the menu_data.js file, and just left it at the bottom of each of the user menu files, so that it only gets called once.
It's fairly easy to edit the individual menus, because the only thing that's in each file is the menu structure itself, no additional style information.
Dallas