Submenus
|
30 posts
|
Hey, I was wondering if there would be any easy way of displaying submenus in the header as a dropdown menu or somewhere on the sidebar?. I appreciate your help on this one. |
|
1493 posts
|
Hi Mitnick: This is how I did it:
Notes: where I have "YOUR-PAGE-HERE", put in the "slug" of the page this sidebar is attached to (find the slug under the "Metadata" link). I think that should work! :) I have made the variables more "abstract" here than in my actual page, so I hope it's all OK. Let us know how you get on. |
|
1493 posts
|
Markdown didn't like the way I put in the code! I'll try again: <pre><code> <h3>Sidebar Title</h3> <?php $page_submenu = $this->find('/YOUR-PAGE-HERE/'); ?> <ul> <?php foreach ($page_submenu ->children(array()) as $menuPage): ?> <li><?php echo $menuPage->link() ?></li> <?php endforeach; ?> </ul> </code></pre> |
|
1493 posts
|
Right. Something funny going on here. I'll try one more time, and if this doesn't work, I'll leave it for Philippe to clean up! :)
|
|
1493 posts
|
Grrr.... Here's a pic: ! |
|
541 posts
|
Haha David .. use 4 spaces or a tab before your code to be set as code ;)
|
|
541 posts
|
and not only before the first line, before each line ! |
|
1493 posts
|
> use 4 spaces or a tab before your code to be set as code ;) I thought I did that the first time!? Maybe I only had three.... At least I know now it is supposed to work! |
|
30 posts
|
Wow, thanks for the feedback guys. Is there any way i can make submenus as a dropdown menu from the existing menu ?. |
|
56 posts
|
I can think of a couple of ways you can do that. Fancy CSS and a bit of PHP, mainly. :D BUT, I have to ask: why do you want to have submenus? There's an age-old mantra with site design: "Everything should be accessible within 3 clicks from the home page." Keeping in mind that sub-menus annoy users more often than not, and will not always show up in every browser (no matter how you do them), they are not an end-run around the mantra. I have learned that, as a rule, submenus tend to go fairly unused by end-users. They only serve as a convenience for the site designer. You would not believe how many times I've heard things like "I wish people would just READ the pages I put up!", only to discover that the pages in question are only available via a submenu (or, worse, a search). Also, another rule of thumb: if you do have to use a submenu for some reason (corporate mandate, for example), keep it 3-5 items short. Less than 3, and it is pointless. More than 5, and users will be overwhelmed. In my opinion, almost every instance of a site with submenus can be better designed with a better structure and contextual links. As an example: Let's say that you have a "Products" page with 8 products. One thing you will see companies do often is have a submenu with each of the products. That solves that, right? After all, you can get to each of the products, right? Well, no. You see, 8 products is enough to confuse the average user (pretend that your average end-user is an untrained monkey, it makes for easier site design). Especially if you have different "editions" of your products. Or if you have similarly named products. These are common cases. How will the average end-user know which to pick? They won't. They will just choose one. And usually choose wrong. And get frustrated. And go to a competitor with a better site, not telling you why they never even downloaded. So, what can you do to fix it? In this case, have a single Products page in the navigation. On this page, you can list your products. I find that enumerating in a fashion like this (for a Products example) works well: (And I hope Markdown cooperates…)
Also, having a comparison chart on that page, with appropriate links (feature-specific pages, buy/try/download links, links to the product pages, etc.) embedded in the chart works very well. With the above, you manage to avoid the clutter and general confusion generated by submenus. I chose a "Products" page as an example, as almost everyone has come across both good and bad examples of them. ;) But, the same concept holds true regardless of the type of page. If you want to see an excellent example of a well-done Products page, let me know and I'll track one down. (One that I have no connection with, even! ;) ) Unfortunately, most well-done pages don't get the recognition they deserve by "Corporate", as the mandate tends to be sub-menus, and those who write the mandates seem to never look at the main pages in the menu. That's no excuse for being a good web designer and helping your customers, in spite of your policymakers, though! ;) Also, since Frog has built-in support for sidebars, use them to your advantage! Since your "main" page for the group will be more trafficked now than otherwise, feel free to put news, promotions, anything else that your captive audience may appreciate. If, in spite of all this, you still insist on a submenu, let me know. I'll poke at the CSS to see if I can't figure out how to do it with Frog. But, the basic idea is that you make an unordered list and show it only when you hover over the list item in the header. You can use the same sidebar code (practically unmodified) to generate the list in your header. The hard part is the CSS! ;) |
|
30 posts
|
Hey Lewellyn, Thanks for the advice, i think you have a point there. I have decided to but the submenu in the sidebar, there is just one thing now. How can i make the sidebar menu recognize "a.current" ? |
|
30 posts
|
And one more thing :) How can i make the submenu recognize this setup ROOTMENU - SUBMENU - SUBMENU - SUBSUBMENU - SUBSUBSUBMENU - SUBSUBMENU - SUBMENU - SUBMENU Any ideas ?.. |
|
30 posts
|
And one more thing :) How can i make the submenu recognize this setup
- SUBMENU - SUBMENU - SUBSUBMENU - SUBSUBSUBMENU - SUBSUBMENU - SUBMENU - SUBMENU Any ideas ?.. |
|
30 posts
|
Omg, it´s now showing right!!. Well my point is that i need to use 3 levels of the submenu. |
|
1493 posts
|
One of the PHP hard men needs to solve this. Philippe has a Here is one simple way to do it, but it involves manually putting the PHP submenu and sub-submenu code in the sidebars of the relevant pages. Say you have a site structure like this:
The main site nav takes care of level [0] and [1]. In the
But in the
And that (I think!!!) will work. It's working for me, anyway. As I say, there must be a way of detecting this and making it all a single, elegant submenu on the level [1] page, but meanwhile, this should at least help! I hope.... (And if the code does not work in the forum, I will cry!) (There is a tab before each line of code ... I promise!) |
|
1493 posts
|
Woo hoo! The code worked! :)) Also, I meant to say: in the Extra Submenu section above, where you get this line:
you need to put the
or something like that. I hope you see what I mean! |
|
1493 posts
|
I am trying to set up an "abstract" version that will test the URL and return the correct submenu with/without sub-submenu depending on whether level[2] has children. Not that with the
But I hope you can see what I'm trying to do: in the sub-submen, I am getting the array for children, and counting them. If the count == 0, then nothing happens ( Does anyone else want to try??? |
|
1493 posts
|
(Can we get an "edit post" function, Philippe?! ;) ) In the second sentence above, "Not that with the..." should read "NotE that with the...". Sorry. |
|
1493 posts
|
Or maybe try to adapt Philippe's nifty new "sitemenu" (see the FAQ part of this forum) code? There might be a way of making it match only a certain branch of the tree? Maybe ... I'm just guessing...... |
|
541 posts
|
Humm maybe I can do that. It will be my christmas gift for you :P |
|
30 posts
|
Wow, thanks guyes. Just what i was looking for.. |
|
27 posts
|
I use Philippe's sitemap function to generate a navigation tree. In my case it didn't need to be contextual (all of the tree is always visible). |
|
191 posts
|
I'm in the learning stages of Frog, and found this thread as I was searching for navigation options. I would like to use Suckerfish type drop down menus with Frog. Will Frog support Suckerfish? From what I read above, I believe it will, I just need to learn the syntax to produce the nested list. Is that correct? I plan to create a horizontal navigation bar, with each item on the navigation bar having a vertical drop down menu on hover. Note: I've never used Markdown before, and hope I figured out the syntax correctly for the link to the Suckerfish menus. |
|
541 posts
|
Suckerfish is a client part (CSS) with a relativly simple list structure. So I will say yes you can do the list for your suckerfish drop down. You will have to pass trow 2 "imbricked" foreach and create the nested list. You markdown is correct :), my english is so so .. I do my best!! |
|
1493 posts
|
This seems to work fine! Here's what I did:
...it all worked! Works in FF, Opera 9.2, and IE6, anyway. Not too shabby. Hope that helps! WARNING! I am typing this very quickly and may well have missed out something crucial! :) Hope not, though. David. |
