2010-10-21 58 views

回答

7

編輯:這是一個更簡單的例子。

無論主題設置如何,它都會使用加蘭。請注意,這也會覆蓋管理主題設置。

function MODULENAME_init(){ 
    global $custom_theme; 
    $custom_theme = 'garland'; 
} 

編輯:全球變化。

如果你的意思是在數據庫中,而不是僅僅在當前頁面更改主題設置,這裏是如何:

// Changes the theme to Garland 
variable_set('theme_default', 'garland'); 

// Changes only the administration theme to Garland 
variable_set('admin_theme', 'garland'); 
+0

在當前頁面上。 – markdorison 2010-10-21 21:15:55

+1

全局$ custom_theme變量可能是您正在尋找的內容,但應該儘早修改它,以便整個頁面只使用一個主題,而hook_init是一個很好的位置。 – wildpeaks 2010-10-21 21:24:19

+0

如果您只是想讓管理主題處於活動狀態,該怎麼辦? – markdorison 2010-10-25 17:02:48

相關問題