如果你的論壇有用很多佈景,你可以在論壇的上方顯示轉換的功能。
當然會員也可以在個人資料裡面變換佈景,如果論壇允許的話。
Open /Sources/Load.php:
Find:
if (!defined('SMF'))
die('Hacking attempt...');
Add After:
function theme_name(){
global $db_prefix,$context,$scripturl;
$resultaa=db_query("
SELECT * from {$db_prefix}themes WHERE `variable` = 'name' ORDER by `value`", __FILE__, __LINE__);
while($rowaa=mysql_fetch_array($resultaa)){
$theme_rowa=$rowaa['ID_THEME'];
$theme_row_namea=$rowaa['value'];
$context['theme_options']="".$context['theme_options']."<option value=\"$scripturl?theme=$theme_rowa\">$theme_row_namea</option>";
}
}
Open /index.php:
Find:
theme_name();
Add After:
loadTheme();
Create themechanger.php:
Add:
<?
global $context;
echo '<center><form name="jumpurl1" onSubmit="return jumpit()">
<select size="1" name="jumpurl2">
'.$context['theme_options'].'
</select>
<input type="button" value="Change it!" onClick="jumpit()"></form></center>
<script>
function jumpit(){
window.location=document.jumpurl1.jumpurl2.value
return false
}
</script>';
?>
將 themechanger.php 放到 /Themes/ 裡面。
然後打開全部佈景的 index.template.php (為了能讓佈景的上方顯示轉換功能):
Find:
<body>';
Add After:
global $boarddir;
require ''.$boarddir.'/Themes/themechanger.php';
更新改變過的檔案就可以了。