I'm doing a PHPTemplate theme, and I was wondering if there was any way to add your own options to admin->themes->configure->*theme_name_here*?

My theme can support multiple colors, and instead of including 5 themes, and limiting it to that, I'd like to provide the user text boxes to change the colors manually, and maybe provide some suggestions.

I looked at Making additional variable availables to your templates, but I don't think that's what I'm looking for.

Thanks in advance.

Comments

doq’s picture

interested too

bradlis7’s picture

I can see reasons for this not to be useful. For one, most people are just going to go to the global theme settings to change the settings.

I've tried looking at the phpTemplate code itself, but I can't tell what would need to be overridden in order to do this.

Is there a theme out there that successfully does this?

--
Bradlis7.com | Churchofchristnet

oscnet’s picture

I had resolved this ,and worked good for my drupal website.
first patch system.module

--- system.module	28 Mar 2006 01:45:41 -0000	1.300
+++ system.module	31 Mar 2006 15:13:20 -0000
@@ -1028,6 +1028,7 @@
  * Menu callback; display theme configuration for entire site and individual themes.
  */
 function system_theme_settings($key = '') {
+  init_theme();
   $directory_path = file_directory_path();
   file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');

then in YourThemeName's template.php file add a function phptemplate_settings()

function phptemplate_settings(){
    $settings = variable_get( 'theme_YourThemeName_settings', array());   
    $form['foo'] = array('#type'=>'textfield','#default_value'=>$settings['foo']);
    return $form;
}

you can get the config value with

  $settings = variable_get( 'theme_YourThemeName_settings', array());  

download patch: http://drupal.org/node/56713

Heine’s picture

I recently ran into some trouble with theme_settings (http://drupal.org/node/45300#comment-86446), although calling init_theme(), itself or via theme() seemed to solve the problem, it actually didn't (http://drupal.org/node/45300#comment-86478). I haven't tested your patch, but does it also work when your theme is not the active theme? Say bluemarine is active and you're accessing the settings of YourThemeName?

edited to add: I see you also resorted to fetch all the settings with $settings = variable_get( 'theme_esjing_settings', array()); That should prevent the issue above.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

oscnet’s picture

>but does it also work when your theme is not the active theme?
It seems not worked. seems can only configure when theme active.
is it a drupal bug or we are on wrong road?

Heine’s picture

Can you confirm in cq. reopen issue http://drupal.org/node/56713 ?
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

oscnet’s picture

I had add a new issue ,http://drupal.org/node/57676, and got a patch for it.
so please test it.

pj169.com