jake on 2008.01.23
at 05:57 pm
set_pref($name, $val, $event, $type)
Most of the information you pass to
set_prefis straightforward. The
$valare simply the name of the variable for the database and the value of that variable.
$eventis what the preference is associated with, in this case the name of my plugin. But it’s harder to surmise the effect of
$type. And a search through Google and the Textpattern forums returns no explanation.
Originally I copied another developer and set this value to
0. While this works it also adds all the settings alphabetically to the main preferences tab. Because I already have a separate tab for my plugin (and this option adds clutter) having all the settings duplicated and unformatted is not ideal.
2creates a hidden preference. No more list in the main preferences yet I can access the information. This is how my plugin is now set up.
I have not made attempts to set the value to
1nor do I know if there are other possibilities. Please leave a comment if you can explain this further and help other developers.
Thanks to Mary we now have clarification on the
$typesetting. If you go into Admin->Preferences you’ll see Basic and Advanced tabs. The
1are to place preferences on these respective pages. The Basic tab is primarily for system settings. But the advanced can be used for a few, relevant options.In most circumstances managing the preferences on another page and using the
2(hidden) setting makes the most sense.
Posted in: Programming · Web