Welcome Guest, Not a member yet? Register   Sign In
Hierarchiel table rows with CI
#1

We have done a CMS for local applications that we use and we need to prepare a wordpress like menu manager. Not an easy task at all and it gets harder with CI. I am trying to follow the tutorial at HERE and it works fine for vanila PHP but with CI that requires views and controls, i just cant fit in as the result are not echoed automatically in the view but passed to the controller to the view.

How do i go about managing this please? Any idea?
Reply
#2

(This post was last modified: 06-03-2016, 03:47 PM by PaulD. Edit Reason: Added a bit more help )

I am not sure why CI makes it harder????

You have data for your menus in the database I presume.
You collect the data and send it to the view (again I presume you can do this).
The view populates the menu depending on the data sent to it.
The menu is controlled via CSS to perform as a dropdown menu normally performs.

Unless you have preset menus, in which the admin lets users choose which menus to display.

This is not particularly hard. Which bit in particular are you stuck on?

1. Do the HTML first
First, hard code a dropdown menu as an example of what you want. Get this to display well and functions as you expected.

2. Identify the data
Now you can start to pick out what data you will need to send to the menu in order to build it dynamically.

3. Hard code it in the controller
Now create an array hardcoded in your controller to mock up the data you identified you need and send it to your view. Alter your view so each menu LI is generated within a foreach loop.

4. Create a table of data
Once that is all working, you can then create tables to store this data. Once you have created tables write a database query to collect it for the controller.

5. Now deal with admin control
Once that is all working, you can start to look at how your admin section will add new data to the data table for customised menus so your users can customise it.

Hope that helps,

Paul
Reply
#3

You can also read up on this post:

Multi-level menu in PHP – how to do it without killing yourself or the database in the process

Part-1

Part-2
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

The old version of Community Auth had an example of how to create a menu with parent/child relationships:

https://bitbucket.org/skunkbad/community...ew-default
Reply




Theme © iAndrew 2016 - Forum software by © MyBB