[1.6] Conditional theme options

Mark threads with "[2.0]" for discussions about features in the longer-term future, "[1.6]" is for short-term. This is not the place for general discussions or plugin or template requests. Only features that are approved to happen by the core team should be listed here for better structuring.
Locked
User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

[1.6] Conditional theme options

Post by yellowled » Mon Jan 10, 2011 2:21 am

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [1.6] Conditional theme options

Post by garvinhicking » Mon Jan 10, 2011 10:22 am

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
onli
Regular
Posts: 2231
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: [1.6] Conditional theme options

Post by onli » Sun Jan 16, 2011 5:41 pm

Do we have conditional plugin options? I could use them.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [1.6] Conditional theme options

Post by garvinhicking » Mon Jan 17, 2011 3:02 pm

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Locked