Page 1 of 1

[1.6] Conditional theme options

Posted: Mon Jan 10, 2011 1:21 am
by yellowled
Okay, so here's another crazy idea: conditional theme options, i.e. in plain text "if theme option A is value X, enable theme option B".

Example use: I might include a theme option to use either a fixed or fluid width layout. Now, if the user opts for the fluid layout, it makes sense to use a max-width for the main container, which doesn't make much sense if the layout has fixed width. It also makes perfect sense to let the user choose a max-width, i.e. if he selects the fluid width, the template could display a set of radio buttons to choose between a max-width of, say, 1024px, 1280px or 1600px.

This would also help to keep the theme options page tidy if template authors offer a lot of theme options. Maybe this concept could also be used for plugin configuration?

YL

Re: [1.6] Conditional theme options

Posted: Mon Jan 10, 2011 9:22 am
by garvinhicking
Hi!

You can already do that in the config.inc.php, just like you do "conditional navigation items" depending on the # that the user previously inputted. You can check for any current variable setting and add/remove options depending on that.

Same applies for plugins, several plugins already show options only if specific options are set...

Regards,
Garvin

Re: [1.6] Conditional theme options

Posted: Sun Jan 16, 2011 4:41 pm
by onli
Do we have conditional plugin options? I could use them.

Re: [1.6] Conditional theme options

Posted: Mon Jan 17, 2011 2:02 pm
by garvinhicking
onli wrote:Do we have conditional plugin options? I could use them.
Yes, in introspect_config_item() you can use any PHP code, also to check with $this->get_config() if a depending config option is set to a specific value. serendipity_plugin_linklist uses this, i.e.

Regards,
Garvin