views:

1796

answers:

7

I'm in the process of learning php and creating themes.

Unfortunately, while I was editing a theme that i was currently using in drupal, I made a mistake in the theme such that nothing shows up anymore, even if i were to hit drupal/index.php. I want to change my broken drupal theme to a working one but i'm unable to do so because I can't even view the administration section.

A: 

As far as I know, theme settings are stored in the database, as well for each individual user. The quickest way to get rid of a theme is probably removing it from the theme path.

Just move it onto your desktop and Drupal should be able to detect that your requested theme is missing and point you to the default instead.

Update: Tried this on my Drupal 5 installation, it turned out 'clean'. I suggest copying a working Drupal theme into your theme directory (make a copy first).

Andrioid
I did what you say and I get the following drupal error:rwtsang_2 is the name of the theme.warning: include(./themes/rwtsang_2/@rwtsang_2/page.tpl.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\drupal\includes\theme.inc on line 1011.warning: include() [function.include]: Failed opening './themes/rwtsang_2/@rwtsang_2/page.tpl.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\drupal\includes\theme.inc on line 1011.
burnt1ce
Weird, I'd swear I've done this myself during my template experiments. Are you sure that the theme is gone from all parts of the Drupal instlalation? This includes /sites/ and /themes.The other options are replacing the directory with a copy of the default drupal theme or going into the SQL database and change your theme settings from there.
Andrioid
A: 

Maybe using two themes in parallel will help.

Set one for the "user frontend" - the one you are developing at /admin/build/themes, another one standard, like garland, which you are NOT going to change, as a "administration backend": /admin/settings/admin.

If you happen to break the theme you're developing, you just go to the admin area (/admin), it will switch back to garland.

voidmain
+7  A: 

The How To reset your theme via the database page on Drupal.org has instructions for changing your theme directly from the SQL prompt.

It's not immediately clear whether this will work in the most recent version of Drupal, so back up your database before attempting this.

Lendrick
Yeah, http://drupal.org/node/200774 looks like it should work.
John Fiala
+1  A: 

In terms of sorting your current problem, here's a simple way to do it that should work... Let's say your current theme is called "custom_theme".

  • Go to your theme directory ("sites/default/themes" probably)
  • Backup your development theme (i.e. move it elsewhere, if you're using Linux command line do something like "mv custom_theme custom_theme.bak")
  • Copy the garland theme to here and name it the same as your broken theme (if using LInux command line, something like this should work "cp -a ../../../themes/garland ./custom_theme"
  • Try viewing your site now. It should now use garland instead of your broken theme.

As others have said before, it's also highly recommended that you use a different theme for admins as you do for normal users (in case you break stuff). Select a safe admin theme (like garland) and then you can nearly always get to the admin interface if you're playing with theming.

x3ja
+2  A: 

The easiest way to change your frontend theme is to set it in your sites/default/settings.php:

$conf['theme_default'] = 'minelli';
Olav
+1 - Indeed you are right. :)
mac
+2  A: 

Or if you are using Drupal 6, removing/moving the broken theme folder will make Drupal change the theme to the default theme (Garland).

Khaled Al Hourani
works for Drupal 5 as well
George Jempty
A: 

It's worth mentioning that if you're using the "Sections" module to apply different themes to different parts of the site, the instructions given on the Drupal site won't necessarily work — you may find that moving the problem theme directory out of the way is the only method of seeing the admin interface properly.

supervacuo