how to make multilevel menu like 

      C & D is the sub-menu of B , 
      B is the sub-menu of A 
      A is main-menu 

css or javascript not php

Member Avatar

There have been many, many threads on this in the past. Perhaps searching this forum will help. However, yes you can get PHP to spit out the HTML required to build an MLM in the first place. As edbr states, you will need CSS and/or JS to make it work. There are some nice CSS-only MLMs that do not require any JS.

JorgeM's version is really cool:

The ease of "nesting" or "levels" will depend upon your datastore. If you have a static menu, then you don't really need PHP at all. If you have a dynamic menu, e.g. updated via admin panel, then you probably do need PHP.

If you do not have a datastore (probably DB) yet, then you have a few options as to how to store the data. The two front-runners are 'adjacency list' model and the 'nested sets' model.

Adjacency, probably the easiest, is where you have a self-referencing parent_id column.
The nested sets, if far more elegant IMO, but probably not worth the hassle if your MLM isn't that complicated. If you are interested, then read this: