dynamic menu with show hide capabilities - understanding possible workflow

dynamic menu with show hide capabilities - understanding possible workflow

am 26.10.2009 14:28:08 von talofo talofo

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:=20
3.1) print it recursively (no idea how to accomplish this)
3.2) print it with some sort of class=3D"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=E1rcio



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: dynamic menu with show hide capabilities - understandingpossible workflow

am 26.10.2009 15:37:34 von Ashley Sheridan

--=-ntpubHCnQw2abiYORzFQ
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 2009-10-26 at 13:28 +0000, MEM wrote:

> Hello all,
>=20
> 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).
>=20
> So I was wondering if It's possible to accomplish it, by using css and ph=
p
> only.
>=20
>=20
> If so, I'm wondering if something like this it's a good way for doing thi=
s:
>=20
> 1)
> Generate a multidimensional array from database table containing categori=
es
> and subcategories.
>=20
> 2)
> Create a css file with two classes one that shows, another that hides.
>=20
> 3)
> Grab that array and:=20
> 3.1) print it recursively (no idea how to accomplish this)
> 3.2) print it with some sort of class=3D"showThis" inside the generated =
html
> element.
> 3.3) make a conditional somewhere (I really don't know where, and this m=
ay
> be related with the recursion doubt), in order to display the children
> elements, only when we click the parent element.
>=20
> And here resides my main doubt: Is the point 3.3 feasible without the use=
of
> js?
>=20
>=20
>=20
> I just need some directions please,
>=20
> Regards,
> Márcio
>=20
>=20
>=20


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


=20

------=_NextPart_000_002E_01CA564D.34859280--

RE: dynamic menu with show hide capabilities - understandingpossible workflow

am 26.10.2009 16:03:04 von Ashley Sheridan

--=-5azFKEF3g6wSYjbilotJ
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 2009-10-26 at 15:01 +0000, MEM wrote:
> Thank you all.
>=20
> =20
>=20
> Ok. Please stay with me, cause I still have some doubts.=20
>=20
> Not only do I need to display the subitems on click but also, when the
> user clicks on one menu item, I need to change the URI as well.
>=20
> Why? Because, each time the user clicks on a menu item (whateaver that
> item as childs or not), I want to display a list of products related
> to the clicked item.
>=20
> =20
>=20
> So, I was trying to avoid js, because, I donâ€=99t know that much abo=
ut
> js. However, Iâ€=99d like to do it properly, so, the only way I was
> allowing the use of js, was by do not disabling the back button
> functionality and by allowing a add to favorites option as well,
> allowing the URI changingâ€=A6 O.o
>=20
> =20
>=20
> Anyway, letâ€=99s face it:=20
>=20
> Js is my only option, could this be a nice workflow, for an
> unobtrusive solution?
>=20
> =20
>=20
> =20
>=20
> 1) Generate the multidimensional array from query.
>=20
> 2) Generate the ul / li menu (echo + foreach) displaying all
> child elements as well.
>=20
> 3) Apply the anchor to the list items.
>=20
> 4) Apply some js to that ul / li that:=20
>=20
> 4.1) will be responsible for show/hide elements.
>=20
> 4.2) Will be responsible to show/hide elements only when some DOM
> node(?) as children.
>=20
> 4.3) Change the URI on click, so that some information can be showed
> based on uri segment.=20
>=20
> =20
>=20
> Can I have your help to fill the blanks here, or, if there are to
> many, just an orientation reference, in order to get startedâ€=A6
>=20
> =20
>=20
> =20
>=20
> =20
>=20
> Thanks a lot once again,
>=20
> Márcio
>=20
> =20
>=20
> =20
>=20
> =20
>=20
> =20
>=20
>=20
> From: Ashley Sheridan [mailto:ash@ashleysheridan.co.uk]=20
> Sent: segunda-feira, 26 de Outubro de 2009 14:38
> To: MEM
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] dynamic menu with show hide capabilities -
> understanding possible workflow
>=20
>=20
>=20
> =20
>=20
> On Mon, 2009-10-26 at 13:28 +0000, MEM wrote:=20
>=20
>=20
> =20
> Hello all,
> =20
> 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).
> =20
> So I was wondering if It's possible to accomplish it, by using css and ph=
p
> only.
> =20
> =20
> If so, I'm wondering if something like this it's a good way for doing thi=
s:
> =20
> 1)
> Generate a multidimensional array from database table containing categori=
es
> and subcategories.
> =20
> 2)
> Create a css file with two classes one that shows, another that hides.
> =20
> 3)
> Grab that array and:=20
> 3.1) print it recursively (no idea how to accomplish this)
> 3.2) print it with some sort of class=3D"showThis" inside the generated h=
tml
> element.
> 3.3) make a conditional somewhere (I really don't know where, and this ma=
y
> be related with the recursion doubt), in order to display the children
> elements, only when we click the parent element.
> =20
> And here resides my main doubt: Is the point 3.3 feasible without the use=
of
> js?
> =20
> =20
> =20
> I just need some directions please,
> =20
> Regards,
> Márcio
> =20
> =20
> =20
>=20
>=20
>=20
> 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.
>=20
> 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.
>=20
> Also, before anyone mentions them, 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
>
>
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: dynamic menu with show hide capabilities - understandingpossible workflow

am 26.10.2009 16:49:59 von Ashley Sheridan

--=-JESFCXFTjdyxPJ/rxz2k
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 2009-10-26 at 08:49 -0700, Jim Lucas wrote:

> MEM wrote:
> > Thank you all.
> > =20
> > Ok. Please stay with me, cause I still have some doubts.=20
> > Not only do I need to display the subitems on click but also, when the =
user clicks on one menu item, I need to change the URI as well.
> > Why? Because, each time the user clicks on a menu item (whateaver that =
item as childs or not), I want to display a list of products related to the=
clicked item.
> > =20
> > So, I was trying to avoid js, because, I donâ€=99t know that much a=
bout js. However, Iâ€=99d like to do it properly, so, the only way I wa=
s allowing the use of js, was by do not disabling the back button functiona=
lity and by allowing a add to favorites option as well, allowing the URI ch=
angingâ€=A6 O.o
>=20
> The JS part isn't for clicking at all. Rather, it is for hovering.
>=20
> Since IE doesn't have hover on any element besides the anchor, it is used=
to
> mimic hovering in IE.
>=20
> Use the following example to add the hover ability to your app.
>=20
> http://snipplr.com/view/1912/internet-explorer-ie6-css-hover /
>=20
> > =20
> > Anyway, letâ€=99s face it:=20
> > Js is my only option, could this be a nice workflow, for an unobtrusive=
solution?
>=20
> Remember, JS is only used to create the ability for IE to hover over elem=
ents :)
>=20
> > =20
> > =20
> > 1) Generate the multidimensional array from query.
> > 2) Generate the ul / li menu (echo + foreach) displaying all child=
elements as well.
> > 3) Apply the anchor to the list items.
>=20
> NO!!! don't do the following!
>=20
> > 4) Apply some js to that ul / li that:=20
> > 4.1) will be responsible for show/hide elements.
> > 4.2) Will be responsible to show/hide elements only when some DOM node(=
?) as children.
> > 4.3) Change the URI on click, so that some information can be showed ba=
sed on uri segment.=20
> > =20
> > Can I have your help to fill the blanks here, or, if there are to many,=
just an orientation reference, in order to get startedâ€=A6
> > =20
> > =20
>=20
> Now to satisfy the people that are going to ask the inevitable question "=
What if
> JS is turned off??"
>=20
> Show everything by default. Then, using JS, hide all that should be hidde=
n and
> go from their.
>=20
> > =20
> > Thanks a lot once again,
> > Márcio
> > =20
> > =20
> > =20
> > =20
> > From: Ashley Sheridan [mailto:ash@ashleysheridan.co.uk]=20
> > Sent: segunda-feira, 26 de Outubro de 2009 14:38
> > To: MEM
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] dynamic menu with show hide capabilities - understan=
ding possible workflow
> > =20
> > On Mon, 2009-10-26 at 13:28 +0000, MEM wrote:=20
> > =20
> > Hello all,
> > =20
> > 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 lo=
ud:
> > "Jquery" .
> > I don't need js for this. Really. (At least, this is what I believe).
> > =20
> > So I was wondering if It's possible to accomplish it, by using css and =
php
> > only.
> > =20
> > =20
> > If so, I'm wondering if something like this it's a good way for doing t=
his:
> > =20
> > 1)
> > Generate a multidimensional array from database table containing catego=
ries
> > and subcategories.
> > =20
> > 2)
> > Create a css file with two classes one that shows, another that hides.
> > =20
> > 3)
> > Grab that array and:=20
> > 3.1) print it recursively (no idea how to accomplish this)
> > 3.2) print it with some sort of class=3D"showThis" inside the generate=
d 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.
> > =20
> > And here resides my main doubt: Is the point 3.3 feasible without the u=
se of
> > js?
> > =20
> > =20
> > =20
> > I just need some directions please,
> > =20
> > Regards,
> > Márcio
> > =20
> > =20
> > =20
> >=20
> > 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 opti=
on really.
> >=20
> > Is there a particular reason you are shying away from Javascript in thi=
s case? There are ways you can construct drop-down menus in a way that if J=
avascript is unavailable, then they fall back to becoming a bog-standard na=
vigation bar.
> >=20
> > Also, before anyone mentions them,