Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Managing plugins preferences
Hi,
is there a kosher way to keep plugins’ preferences in the database?
I thought txp_prefs would be a candidate for this, but don’t want to break other things or prevent forward compatibility.
Maybe using my 3 letter prefix in the name field would suffice… but there are already names that start with 3 letters and a “_”:
img_, log_, max_, rss_ (Rob Sable is out), url_ and use_ are all used by standard preferences in my clean 4.0.5 install.
Maybe using a double “_” would do, but I’d like to know if is there a documented or widely used way to put plugins’ options within the database…
TIA
Mariano Absatz – El Baby
I don’t suffer from insanity. I enjoy every minute of it.
Offline
Re: Managing plugins preferences
Use the plugin name as a prefix. That should be more than enough to prevent collisions.
Offline
Re: Managing plugins preferences
It would be nice to see a specific table for this, where prefix and plugin name are different columns like:
- author prefix
- plugin name
- preference name
- preference value
Sure, you could put prefix and plugin name in one but it would be nice to find all preferences by the same author if you re-use them in several plugins (for some reason).
Plugins:
ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
#4 2007-12-27 22:45:51
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Managing plugins preferences
Like Manfre said.
Offline
Re: Managing plugins preferences
Yeah, but as I noted before, the prolific Rob Sable (a.k.a. rss_*) is prevented from this (there is already a standard pref entry prefixed with rss_).
Mariano Absatz – El Baby
I don’t suffer from insanity. I enjoy every minute of it.
Offline
#6 2007-12-28 00:41:52
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Managing plugins preferences
No, the plugin’s name, not prefix.
For instance, the pref for upm_img_popper is prefixed with “upm_img_popper_”.
Offline
Re: Managing plugins preferences
But then comes the time when I want a generic prefs for multiple plugins and say my author prefix was rss. Ofcourse, I could name it through the plugin that first created it but ..
Or we do a prefix_generic_SOMETHING.
And don’t take this as something is wrong in the previous statements. Just thinking up ideas of how to solve it in a good way ;).
Last edited by obeewan (2007-12-28 00:44:39)
Plugins:
ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
#8 2007-12-28 01:25:00
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Managing plugins preferences
In that insrance, I think it’s worth doing a library plugin for the purpose (shared prefs, functions, etc).
Offline
Pages: 1