Menu order Up or Down |
[eluser]Unknown[/eluser]
Hi! I'm very new to Codeigniter and PHP. But I am right now trying to make menu fully dynamic so that my client can change title, url and order on the site menu. I can't find any help or anything on how to change the menu order (+1 or -1). It would be very nice if you could help me with this. I do have a database with a "order" column. Wich I place the orderID in. Would be very kind if you could help me. Thanks!
[eluser]csotelo[/eluser]
I would use jQuery UI sortable library: http://jqueryui.com/demos/sortable/#default And when you click a button, get an array with the order of items, which will be updated in your BD.
[eluser]Unknown[/eluser]
Thanks csotelo! That's really nice. But the I wonder (As told before, I'm not a PHP guru) how I post this in to the database. My structure looks like this Code: CREATE TABLE `dyn_menu` ( The 'position' is the order of the menu. And the 'parent_id' is the id of the 'page_id'. It tells if the link is parent or not. If not the value is 0. Sorry if this is a stupid question.
[eluser]csotelo[/eluser]
Hello, the question is not stupid, on the contrary, the issue is complex. Since you need to put together a menu and indefinitely or multilevel submenus, which can be repositioned. What I showed you only part of UI to be as friendly as possible. What you show in your CMS is something like this: http://boagworld.com/demos/sitemap/ Now, the internal issue is complex and involving the logic of PHP and MySql. You need to check the topic of nested and/or hierarchical records. You can see the topic here: http://ellislab.com/forums/viewthread/57707/ And I hope someone with more experience will provide some library in CI 2 to handle these types of records. |
Welcome Guest, Not a member yet? Register Sign In |