Ask Agaric: Settings for a Drupal theme without requiring a module
Hi,
I've been breaking my brain over some issue and I cant figure it out so I
figured I'd check with a fellow themer(s?)![Related d.o. thread: http://drupal.org/node/247032 ]
What I'm basically trying to do is use drupal theme settings in a file
that is not processed by drupal, and its part of a theme. I also do not
want to use any modules with it because I dont want the theme to be
dependent on a special module :)
Hello Jurriaan,
I've thought about this a lot myself. My current thoughts are that it doesn't seem too difficult (but I'd like to test the performance cost) to parse an .ini file.
The theme could then use the settings in the theme directory or conditionally override these settings from a specifically named file in the /files directory, if it exists. You would probably need a helper module if you want people to be able to edit this file through the user interface, but the theme wouldn't be dependent on this module and settings could be changed in the familiar somesetting = somevalue format.
Drupal 6 I understand makes more advanced theme settings possible without a module such as http://drupal.org/project/themesettingsapi -- but as the best-maintained community module, that's not a bad "optional requirement" for your theme either-- simply provide sensible defaults if ThemeSettingsAPI isn't present.
I can locate my notes on parsing .ini files if you're interested.
Good timing on writing in! I like your theme work and I need to put up a site quickly, so I think I'll use one... Agaric co-founder Dan Hakimzadeh is the expert themer, but I consult on questions about this gray area between modules and themes.
(Please note that we post questions and our answers to AgaricDesign.com to share any knowledge people may glean from them. Let us know if there's information you would like excluded.)
benjamin
Agaric Design Collective
Open Source Free Software Web Development
http://agaricdesign.com/
Comments
Related Content
See Agaric's secret plan to store configuration settings in ini files.
Post new comment