Nov 23, 2012; 15:53
Jussi Hirvi
Hierarchical menu
I would be interested to know, how others have done this.
I have a category table "cats" with
id=1, name=cat1, parentcatid=2, name=cat2, parentcatid=3, name=subcat1, parentcat=1
So id=3 is a subcat of id=1.
Now I need to do things like build a nice select menu for "cats" which
would look contain something like
<option value=1>cat1
<option value=3>--subcat1
<option value=2>cat2
I have done this by building a hierarchical array, something like
array( 1=array(cat1,3=subcat1),
2=cat2
)
On iterate I can do if($i->second->type == 'array') to spot those cats
which have subcats.
If I need unlimited number of tiers in the hierarchy, this gets complex
(I need to call the tag again from inside the same tag).
Any other, maybe more intuitive solutions?
- Jussi
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso
Lasso@lists.lassosoft.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
Nov 23, 2012; 17:04
=?iso-8859-1?Q?Torbj=F6rn_Nordlindh?=
Re: Hierarchical menu
Nov 23, 2012; 12:58
Steve Piercy - Web Site Builder
Re: Hierarchical menu