Re: dynamic menu with show hide capabilities - understanding possible workflow
| From: | Ashley Sheridan | Date: | Mon, 26 Oct 2009 14:37:34 +0000 |
| Subject: | Re: dynamic menu with show hide capabilities - understanding possible workflow | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299343@lists.php.net to get a copy of this message | ||
On Mon, 2009-10-26 at 13:28 +0000, MEM wrote:
> Hello all,
>
> I'm on my way to build my first dynamic menu using php.
> However, each time I say this, people start jumping at me crying out loud:
> "Jquery" .
> I don't need js for this. Really. (At least, this is what I believe).
>
> So I was wondering if It's possible to accomplish it, by using css and php
> only.
>
>
> If so, I'm wondering if something like this it's a good way for doing this:
>
> 1)
> Generate a multidimensional array from database table containing categories
> and subcategories.
>
> 2)
> Create a css file with two classes one that shows, another that hides.
>
> 3)
> Grab that array and:
> 3.1) print it recursively (no idea how to accomplish this)
> 3.2) print it with some sort of class="showThis" inside the generated html
> element.
> 3.3) make a conditional somewhere (I really don't know where, and this may
> be related with the recursion doubt), in order to display the children
> elements, only when we click the parent element.
>
> And here resides my main doubt: Is the point 3.3 feasible without the use of
> js?
>
>
>
> I just need some directions please,
>
> Regards,
> Márcio
>
>
>
Everything there is feasible without Javascript except for the clicking
part, which is pretty essential to what you want. Pure CSS-only menus
are still unavailable because of IE, so using some Javascript is your
only option really.
Is there a particular reason you are shying away from Javascript in this
case? There are ways you can construct drop-down menus in a way that if
Javascript is unavailable, then they fall back to becoming a
bog-standard navigation bar.
Also, before anyone mentions them, <select> lists are not the same thing
as a drop-down menu, and navigating to different parts of a document
upon changing the selected option is actually breaking their default
behavior, and can become confusing to people who expect them to work as
select lists.
Thanks,
Ash
http://www.ashleysheridan.co.uk