In my system I have a flexible layout, where you can place your sidebar left or right (or both). You can add multiple sidebars and then choose which one you want to use for your page, and on which location.
What is the best way to store the items in a sidebar, while maintaining the ability to edit the item configuration per sidebar?
The items consist of a php class in which the config options are passed through to a template file.
My origional thought was to implement some sort of shortcode functionality and add a shortcode to a sidebar_item entry in the database, but this way it wouldn't really be configurable.
If I understand you correctly, you have:
and every user has his own sidebar with his own content.
I can propose tables:
users
in which users are defined by some id,sidebars
in which you say which user it belongs to, and if it is left or right,item_types
where you say which template and/or configuration files should be used,items
in what type it is (from item_types
), so you know which template to use, then in which sidebar (from sidebars
) it is, maybe what position it is (first, second, ...).You should create relations between:
sidebars
and users
on user id so selecting user you could know which sidebar(s) he owns,items
and sidebars
on sidebar id, so knowing sidebar you know which items are in it,item_types
and items
on item type so you know how to handle it,Perhaps, in items
you can also store configuration variables that you could pass to template.