Storing site settings (including theme settings like images) #877
-
Hello, I'm working on my first backpack website! I'm trying to figure out what is the "best" method for storing data like "logo", main background image, copyright and so on. I looked into the add-on settings, but that only allows you to store strings, not things like uploading an image. My current solution is to just create a new model called site_theme_settings and add the need columns and only have 1 row. But this seems like a bad practice. So far I have just disabled CREATE and DELETE so you can just list / view / update the one row. I'm using the PRO version and have DevTools. I also have the following add-ons: PageManager, PermissionManager, PageManager. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hello @joshwegener I think Setting is your best choice. Maybe you miss how to config fields, but there is a way to handle images, per example like this:
Then, this will store the image in base64 in db. Cheers. |
Beta Was this translation helpful? Give feedback.
-
Hello @jcastroa87, That would make all the settings “image” type. I need some to be text, some to be images. Something like, name, type, value where value would change based on what type you selected. Thanks |
Beta Was this translation helpful? Give feedback.
-
Just as @jcastroa87 explained, you can use the settings package.
I have different fields definitions like You can add fields in a class
and then when you need, you can run |
Beta Was this translation helpful? Give feedback.
-
Great, you solve it, I will close the issue, but feel free to re-open or create a new one. Cheers. |
Beta Was this translation helpful? Give feedback.
Hello @joshwegener
I think Setting is your best choice. Maybe you miss how to config fields, but there is a way to handle images, per example like this:
Then, this will store the image in base64 in db.
Cheers.