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.

hope this makes since.

Comments

add1sun’s picture

Version:6.x-2.x-dev» 5.x-1.x-dev

We'll look at features once we get a nice, stable version for 5 done. Moving this to 5 dev since that is where this code will go.

TKS’s picture

rz -- this would be a very useful patch, thanks!

Question for you, though: Would it be easy to also allow for a specified ending depth? IE, to limit nice menus to the top 2-3 levels of a much deeper menu tree?

I've looked at your patch code, but I'm afraid the drupal menu system still makes my head spin. Any suggestions?

Thanks
TKS

add1sun’s picture

Title:Ability to start menu at a particular depth» Choose starting and ending meu depth
Version:5.x-1.x-dev» 6.x-2.x-dev
Status:Needs review» Needs work

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.

add1sun’s picture

Title:Choose starting and ending meu depth» Choose starting and ending menu depth

grr, typo.

vipconsult’s picture

So is this patch working now than ?

add1sun’s picture

No the patch needs to be rewritten (hence the "code needs work" status) to include the other issue listed as well and to be updated to the latest code which has changed a bit since April.

vipconsult’s picture

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

Thanks a lot if could help me.
Kind regards

bmagistro’s picture

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.

add1sun’s picture

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.

bmagistro’s picture

StatusFileSize
new11.15 KB

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.

bmagistro’s picture

Status:Needs work» Needs review
StatusFileSize
new11.2 KB

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

bmagistro’s picture

StatusFileSize
new16.93 KB

as i said here is the patch but it doesn't look clean at all. I am not sure why, the file in #11 is the .module file just renamed

add1sun’s picture

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:

cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d nice_menus -r DRUPAL-5 contributions/modules/nice_menus

I've been swamped this week but I'll try to take a look at this over the weekend.

bmagistro’s picture

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.

add1sun’s picture

Status:Needs review» Needs work

patch needs to be reworked to work in HEAD.

bmagistro’s picture

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?

add1sun’s picture

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.

bmagistro’s picture

I will try and take a look at it over the next week. If it helps the version that is built on is 5.x-1.1.

add1sun’s picture

StatusFileSize
new4.41 KB

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.

bmagistro’s picture

I agree the diff is messy there. but i looked at your patch and it looks like you got everything. thanks for taking care of this.

devondan’s picture

Hi All,

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.

bmagistro’s picture

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.

add1sun’s picture

Assigned:zroger» Unassigned
StatusFileSize
new4.32 KB

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.

bmagistro’s picture

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

EugeneMann’s picture

One possible solution is to use CSS to hide the menu ULs past the depth you want. For example, I only wanted two layers of menu so I add this to nice_menus_default.css:

ul.nice-menu ul ul { visibility: hidden;}

To make the menus look nicer, i also disabled the arrow-right.png in the appropriate background tag.

bmagistro’s picture

That may work, but it is not an ideal solution because the page must still load all of that information. By processing it server side you decrease what must be sent to the client.

bensnyder’s picture

I am assuming that these patches are to be made against version 5.x only... and not 6.x.2.x-dev... right?

I need this functionality like now... lol so I guess I will take a look at the logic u guys implored and write it myself for 6.x.2.x-dev...

Hope I made sense....

add1sun’s picture

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.

bensnyder’s picture

Guys in 6.x install the Local Menu module.

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.

add1sun’s picture

Status:Needs work» Needs review
StatusFileSize
new6.89 KB

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.

add1sun’s picture

Needs a reroll now that the JS patches have landed.

add1sun’s picture

Status:Needs review» Needs work

darn it, meant to set to CNW

add1sun’s picture

Status:Needs work» Needs review
StatusFileSize
new6.85 KB

New patch.

scottrigby’s picture

Status:Needs review» Needs work

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

bensnyder’s picture

This may be a dumb question but is this patch against the dev release??

Thanks in adv!

scottrigby’s picture

forwarding a response from add1sun - in relation to this and another recent patch:

...these patches are against the HEAD version of Nice menus (which is Drupal 6 compatible.) You can get HEAD from either directly from CVS or use the tarball at http://drupal.org/node/95964.

it worked for me :)

scottrigby’s picture

Status:Needs work» Needs review

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’s picture

This latest D5 patch applied cleanly for me, but did not work. nice_menus still rendered the full menu tree. I realize further development is going on on D6. Not sure what broke the D5 patch yet.

add1sun’s picture

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

scottrigby’s picture

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

add1sun’s picture

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.

scottrigby’s picture

I didn't realize that was an option – thx for clearing that up add1sun :)
So really this patch only provides ending depth... has anyone found any issues with the patch as it is now?

add1sun’s picture

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.

scottrigby’s picture

thanks add1sun! that'll be helpful in appplying that other patch ;)

add1sun’s picture

Status:Needs review» Fixed

This has been committed to the 6-2 dev version.

Anonymous’s picture

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

kervi’s picture

Status:Closed (fixed)» Active

ehm, can this patch be ported to d7 please?

ratish@cybex.in’s picture

how can create drop down menu in drupal 7. please suggest me

add1sun’s picture

Status:Active» Closed (fixed)

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