Jump to:

This patch allows a nice_menus block to start at a specified depth. This allows you to specify that you want a nice_menus block for the primary links menu but to start at depth 2 which would then get you a nice_menus secondary navigation block.

http://drupal.org/node/169413 is marked as a duplicate of this and I am retitling this to include both starting and ending depth. The patch will need more work to do both and be worked against nice_menus HEAD.

I need to finish a website until end of next week .
Could you spend few minutes and change the hard coding so it only show the first two levels of the navigation and than attach it to this post ?
I would really appreciate if you could do that.
And probably it would be very useful.
I would do it myself if I could , but unfirtunately I am not that experienced with php...

I will be writing the ending depth since I need that now. I probably will not be able to create the diff/patch because I don't know how yet. But I will be developing against 5x-1.1 and will post the completed file once it is working.

Hey there bemagistro, patching is pretty easy once you get set up for it. Here is the handbook page: http://drupal.org/patch/create. If you are on a Linux or mac system getting set up is easy. On windows you just need to either install TotoiseCVS or install a program called Cygwin and then follow the handbook.

this code file will let you choose how far down it should drop, can someone try it out, just replace the one that comes with the current 5x-1.1 release. i'm too tired to try and learn to create a diff in windows... I will look my code over tomorrow to make sure i didn't do something stupid and that it really does work right but i wanted to get this out there and let someone else bang on it.

edit:

there is a bug, minor you cannot set a block to not drop down i will get that fixed tomorrow.

attached is a revised version, I will try and get a diff/patch created and attached later today. the file below is built against 5x-1.1 and fixed the problem of not being able to set the limit to 0 drops

hey bmagistro, thanks for working on this. The patch is screwy because the code you worked on is for Nice Menus 5 but HEAD is compatible with 6. To do a patch against the 5 branch you just need to do a cvs checkout with -r DRUPAL-5 added to it. So like this:

Thanks for that, I will have to give it a try. I'm still learning this cvs stuff. I usually just program for myself and it never gets released. I know the swamped feeling way too well and it doesn't look like its going away anytime soon.

I would love to do it because it is something I use, but I don't have the time. The soonest would be a week or two?
Can you give me a heads up as to what changed function wise, if anything? or was the code just reworked to perform better and different than what the patch was based on?

Functionally it is the same but Drupal's APIs change between versions and in D6 the menu system got completely rewritten so the code was changed to work with the D6 API. Updating your code for HEAD shouldn't be too hard but since we never got a clean patch against 5 it is hard to see exactly what are the changes you made for just this issue. We need to run a diff on your complete code from before (#11) against the version of Nice Menus at the time to make a clean 5 patch so that it is easier to see what changes will also need to be made in HEAD.

Ok, the txt from #11 totally didn't diff well so I just went ahead and manually looked for changes in the file and updated it. The attached diff here is against the 5 dev branch. I think I got all of the changes but please take a look at it and see. Now that I can see the changes, I will redo this to go against HEAD when I have more time.

Really good to see this patch is being worked on. Exactly what I am looking for (drop down menu that shows only children, not children of children etc...).

Ran "patch -p0 < nice_menus-depth-135771-19.patch" using Cygwin and I get
patch: **** malformed patch at line 87:

I don't have the experience to know quite what this means. I tried the #12 patch on the off chance that might be sufficient for my needs. That gave me the drop down list for depth. Set to "0" it gave me only parent items in the list, but anything else gave a full menu. Please let me know if you want any more information. I'd be happy to test more thoroughly if you want the help.

I am not sure what that means either, I am not as familiar with patching as I would like to be. Are you saying that you need starting depth too? I thought I had the code set so things like 1 would only be one level below parent, but I am not sure anymore. I did a lot of this while I was half asleep so if I did make a mistake like that I would not be the least bit surprised.

Dunno what I did on that patch but I rerolled it so it isn't malformed anymore (against 5 dev still.) The patch totally doesn't work though and in looking at the code I noticed there is a $i that is never set or incremented anywhere and is not connected to the $deep variable. I don't have time to figure out what it should be.

I will try to look at it this week. I do have the full file posted above but I would like to get this as a patch against 5.x-dev so that it can be included in future releases. I will see what I can do...

Yeah, these patches are against 5 but we really need a patch against 6 instead since that is where I'll add it. If you do get a working D6 version please do file the patch back here so I can roll it in.

What Nice Menus needs is a Starting Depth and Rendered Depth just like Local Menu while at the same time having a Menu Source.

> The Menu Source should tell the menu from which menu to render.
> Starting Depth & Rendered Depth should print links relative to whatever page the user is on and where that page fits in the Menu Source.

OK, here is a first pass at a patch for 6. This is against HEAD and seems to work pretty well in my limited testing. The styling for the parent menu items is still there, even if we aren't showing children now but that can be fixed up later. I want to see if this is working for others and how buggy it may or may not be. Please test it out.

Hi add1sun,
This patch works great for my purposes – which is to set a menu depth starting with the parent.
It's on the block configuration for each menu, which makes sense as we may want to set diff depths for the various menus...
Works like a charm!
:) Scott

safe to change the status? Even though I reviewed and tested it, I don't know that I count as 'the community' all on my own :) so setting status to "code needs review".
@pegleglax: maybe you can check & see if you find the same results?
Cheers! Scott

@brandonvalentine, the D5 version of the patch doesn't work at all and apparently never did (at least in my testing it didn't). The only working version is against HEAD and there won't be a D5 version at this time. If we can get this into HEAD and eventually get a v2 release of Nice menus out, only then I would be open to someone rerolling this and backporting to to 5.

So we need some other people to test against HEAD, right? For me, setting an ending depth works (and is the most important part IMO, because while a certain depth can be hidden using CSS, the browser still has to load all the info, which can be a lot depending on the menu). I really don't understand how the starting depth would even work, and seems this part of the initial patch has been dropped, right? I ask only because people testing need to know what to test.
Thanks :) Scott

Well, yeah in the sense that you can always pick the parent menu item you want to start with. That is, you can decide to pick the "starting depth" of the Site building menu and then set it do an "ending depth" of 1. So really the starting depth thing is moot since NM has let you pick your starting menu in the original module and this patch just lets you pick the depth of the children from the parent you pick.

I'm going to go ahead and put this patch in HEAD by this weekend if no bug reports come up by then. I want to do it when I have time to reroll the expanded parent issue patch since putting this in will break that one.

@ratish@cybex.in Please do not hijack old threads for support and add crazy tags. There is a Drupal 7 version of the module, but it is still buggy. If you have specific problems when using the module, please open a new issue for the specific problems you have.

@kervi, this code was added years ago and should be in Drupal 7. If it is not working properly, please open a new issue against the Drupal 7 version so it can be looked at there.