I have a threaded find result which I do pass to the helper.
The helper should help me to generate a navigation like it is shown here:
CODE OUTPUT NEEDED:
I tried to get it work with a node element which looks like this:
Also a var_export array is given to test.
The problem is, that the vars $firstChild and $lastChild always do give me boolen true back on each child item so that I can't figure out if the child ist the last item of the dropdown menu to close it with a closing ul tag.
A other solution would be to extend the helper code to pass the needed class defintion for the nested ul list as a second argument. At the moment the main ul and li class can be defined but the list is basicly correctly generated by the helper.
Changing the behaviour of a helper to fit a specific front-end framework is not productive and will reduce the overall helpfulness of the helper to others not using your chosen front-end framework.
I would suggest either creating your own helper or extending the CakeDC one.
Here is a method for bootstrap nav https://github.com/infinitas/infinitas/blob/dev/Core/Menus/View/Helper/MenuHelper.php#L169-L222
You dont need to know if its first or last in the list. Just a recursive function will do.
I don't think this repo should contain bootstrap related features any how. There are already a number of full featured bootstrap plugins for CakePHP available.
Thx to all the feedback. Will checkout your MenuHelper dogmatic.
dear netstyler, did you do writing the bootstrap nav with TreeHelper?
cybercoder: Yes we use Treehelper to display the bootstrap Menu. We needed to extend the Utile Tree Helper to be able to use bootrap nav properly. We did overwrite the _attributes method to set all needed classes by depth
finaly I made it myself :
Like netstyler said, this can be done by extending the helper and overwriting the _attributes() method to generate the elements and classes as you want them to be.
@cybercoder thank you for sharing your code. I found the code at
@faiyazalam It compatibles with bootstrap 2.x only.