Dec 04, 2008, 02:34 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Donate to MODx: Donations
Pages: [1]   Go Down
  Print  
Author Topic: How to get DropMenu to *display* the hidemenu=1 items  (Read 3753 times)
0 Members and 1 Guest are viewing this topic.
The Man Can!
Testers
*
Posts: 296



WWW
« on: Jan 04, 2006, 12:57 AM »

Hi all.  I'm going crazy trying to get this to work.  All I want is to have DropMenu display the items with "Show in Menu" unchecked, and hide those with it checked.

From the code it looks as simple as changing (line 190)
Code:
function filterHidden($var) {
return (!$var['hidemenu']==1);
}
to
Code:
function filterHidden($var) {
return (!$var['hidemenu']==0);
}
but that outputs the exact same thing!  I'm so confused.  Even when I remove that whole function, and line 201 too, it still outputs the same thing.  The page is non-cacheable, the snippet is in [! !], I've refreshed the site. I can't think of anything else. Huh
« Last Edit: Jan 04, 2006, 01:49 AM by The Man Can! » Logged

Need MODx Ecommerce? Try FoxyCart!
Dimmy
Testers
*
Posts: 1,826


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #1 on: Jan 04, 2006, 06:28 AM »

try this:

remove the ! (! means "if not")
Code:
function filterHidden($var) {
return ($var['hidemenu']==1);
}

original it will see if hidemenu in $var is not the same as 1 then it shows the items.
by removing the ! it wil see if hidemenu is the same as one and then show the items.

good luck
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
The Man Can!
Testers
*
Posts: 296



WWW
« Reply #2 on: Jan 04, 2006, 09:59 AM »

Thanks Dimitri.  I actually tried that as well and it doesn't change the behaviour of the snippet at all.  ?  Unless I'm going crazy...

No, I just checked again, it displays the exact same thing regardless of 0 or 1, ! or not.  (I'm using 0.9.1 now but I had been trying this on 0.9.0 with the same results.)
Logged

Need MODx Ecommerce? Try FoxyCart!
The Man Can!
Testers
*
Posts: 296



WWW
« Reply #3 on: Jan 06, 2006, 01:38 AM »

Ok, this is odd.
Short Answer:  Changing the 1 to a 0 does indeed work, but not if another non-modified DropMenu snippet is called prior to the modded snippet call.

Long Answer:  One of the sites I'm working on has a main nav on the left (vertical), and a subnav across the top (horizontal).  Check it out here: 209.126.144.59.

The left DropMenu is modded to display weblinks correctly (called as DropMenuTMC), the subnav is a regular DropMenu, and on the Course/Member page, I'm calling a third DropMenu (named OrgList) modded to show the "don't show in menu" items.

Guess what:  Whatever the code that is in the first DropMenu call gets called for all three dropmenus regardless the modified code that's actually called, and regardless the names of the snippets.  If I change the DropMenuTMC (leftnav) to show hidden items, all three menus show hidden.  I change it back, all three menus show the non-hidden items.

Anybody want to confirm this?  For the time being, I'm making the 0/1 value that I need changed as a value that's passed to the snippet, so I can use actually use the same snippet for all three, but this seems like it could be a pretty ugly issue for anybody that needs differently modded dropmenus on the same page.
Logged

Need MODx Ecommerce? Try FoxyCart!
The Man Can!
Testers
*
Posts: 296



WWW
« Reply #4 on: Jan 07, 2006, 07:25 PM »

This doesn't work either:
For the time being, I'm making the 0/1 value that I need changed as a value that's passed to the snippet
So... If you pass a 1 into the first DropMenu call, then a 0 into the second, they both get 1s.

Just in case you want to see the code:
Code:
$showHidden = (!isset($showHidden)) ? '1' : "$showHidden";

if (!isset ($MakeMap_Defined)) {
function filterHidden($var) {
return (!$var['hidemenu']==$showHidden);
}


This is driving me nuts.  Anybody have any ideas on how to make this work?  Thanks!
Logged

Need MODx Ecommerce? Try FoxyCart!
rthrash
Foundation
*
Posts: 9,577



WWW
« Reply #5 on: Jan 08, 2006, 08:50 AM »

Brett, can you file this in the bugtracker so it doesn't slip by without resolution. That's really odd... :/
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
The Man Can!
Testers
*
Posts: 296



WWW
« Reply #6 on: Jan 09, 2006, 04:33 AM »

Roger that Ryan.  It's been added, but I think I did a pretty lame job of concisely describing the problem Wink

My PHP is pretty bad, but does it perhaps have something to do with
Code:
global $MakeMap_Defined;
? I think my next step is to start renaming functions and see if I stumble on the issue. 
Logged

Need MODx Ecommerce? Try FoxyCart!
rthrash
Foundation
*
Posts: 9,577



WWW
« Reply #7 on: Jan 09, 2006, 08:20 AM »

I think it's time to probably isolate this into a proper class as was done on the MemberCheck snippet.
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
The Man Can!
Testers
*
Posts: 296



WWW
« Reply #8 on: Jan 17, 2006, 11:31 PM »

Thanks for those tips, Ryan.  I was reluctant to put it in the bugtracker until I got it working (trying to save you guys the extra work Wink ), and I just got it.

In case anybody else stumbles on this thread with the same problem, I was able to get around it by changing the names of the following functions:
MakeMap
MakeMap_Defined
filterHidden
filterEmpty

I just added a 2 to the end of each function and all is well.  Now I have one folder with two entirely separate menus.
Logged

Need MODx Ecommerce? Try FoxyCart!
rthrash
Foundation
*
Posts: 9,577



WWW
« Reply #9 on: Jan 18, 2006, 12:20 AM »

Thanks Brett!
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!