Hello -
I'm playing around with creating a theme and don't quite know where to find documentation on theme options.
Here are things that I understand...
What I don't understand is...
I have been looking at the Stopdesign files because they are pretty organized.
So in the Stopdesign themeoptions.php file there is this code...
`class ThemeOptions {
function ThemeOptions() {
/* put any setup code needed here */
setOptionDefault('Allow_comments', true);
setOptionDefault('Allow_search', true);
setOptionDefault('Gallery_description', 'You can insert your Gallery description using on the Admin Options tab.');
setOptionDefault('Mini_slide_selector', 'Recent images');
}`
But when I got to my admin page I see that my Mini slide selector has been set to Random images (which is what I changed it to). Why doesn't is go back to default if I move away from the theme. Not that I'm complaining, I just don't understand why. And also there are only four setOptionDefault values here but on the theme options tab there are 12 options. The discrepancy leads me to thing that there are other things going on that I'm not aware of.
And then I look at the index.php for the Stopdesign theme and see these thumb_crop_height/width in the ...
`
Have you looked at http://www.zenphoto.org/2008/05/theming-tutorial/? Also of interest would be http://www.zenphoto.org/2008/04/zenphoto-plugin-architecture/ which describes the plugin architecture (Themeoptions are a class of Zenphoto plugin.)
Some quick answers to your questions:
themeoptions class is defined in the theme's themeoptions.php script.themeoptions class defines.setOptionDefault() sets the default value of the option. What that means is that if the option currently has not had a value set it will set the value. If the option already has a value it does nothing. setOption() always changes the value of the option.The themeoptions.php script defines options that are [b]specific[/b] to the theme. There are also options (primarily about image display) that all themes have in common. These are defined by Zenphoto.
Thanks for the reply - more questions though...
I checked out the plugin architecture and don't quite get some things quite yet...
"The current Zenphoto implementation makes use of two classes: spamfilters and themeoptions."
So this is saying that the themeoptions class is something defined by the theme creator (but is an "official" class recognized by ZenPhoto).
However - where do I find info on the options that all themes have in common? And how do they end up on the theme options page?
setOption() items in the Stopdesign code from above did not seem to overwrite the values shown in the theme options tab. And why are there three values passed instead of two?Thanks!
The themeoptions class is specified by the Plugin Architecture. Each theme may create an instance of this class that does the particular option handling it requires.
Admin.php defines the common options and causes them to appear on the theme options page. (It also causes the theme-specific options to appear on the theme options page. and handles all other options as well.)
setOption() you will see that the third parameter allows the setting of the option to be non-persistent. This accounts for the behavior you observe.