PHP Function for Nested Menu Structure (from MySQL DB)
This project was awarded to doluongsl for $50 USD.Get free quotes for a project like this
Browse Related Skills
Other things people do on Freelancer
Project Budget$30 - $250 USD
Write two functions in PHP using modern conventions optimized for php5 and with no external dependencies. The output must exactly match the format of the included code. Please carefully review attached files.
These functions are dealing with outputting menu structure based on a database. A sample of the database is included. The structure works by child categories nesting below parent categories.
Category “Animals” might be parent tab 0 (top level) and might have a record ID of 14. There could be a couple child records like “Dog” with parent tab 14, and “Cat” with parent tab 14. Parent Tab “0” is always a “top level.” Every element also has a “sort weight” which is the “order by” value to sort the display order by. These are sorted ascending…so if “cat” had a sort wither of 3 and “dog” a sort weight of 85…cat would obviously be displayed first, and dog later.
Accepts two parameters, the current user id number and the current active page. The function will query the list of all pages that are allowed for this user, and output them in a nested ul/li list. Example output is provided and must be matched EXACTLY. It is fine (perhaps even expected) to write an additional function to call as a sub-routine. If the “Allowed User Id” is “|ALL|” then it will always be displayed regardless of current user ID. If a sub-element is allowed, then the parent must also be displayed (even if permission is missing on the parent). Ignore any entry where `ParentTab` = “FUNCTION”.
Pretty self-explanatory, except there are not complete records in the database to demo this at multiple levels deep. Basically take the input URL, find it in the database table, and then recreate each level it took to get there in a ul/li list with links and titles. Example is provided.
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online