[FONT=Verdana, Arial, Helvetica, sans-serif]Forumun Altına Tema seçeneği koymak[/FONT]
Ziyaretçiler ve üyelerin profil ayarlarına girmeden varsayılan temalarını değiştirmelerini sağlar. Forumun en altına tema listesinin seçilmesini sağlayan bir menü ekler.
Default Theme > Babylon Theme> Classic Theme> Dilbermc Theme
source/Themes.php yi aç
bul
PHP:
'pick' => 'PickTheme',
Sonrasına ekle
PHP:
'qpick' => 'QuickPickTheme',
Bul
PHP:
function ThemeInstall()
öncesine ekle
PHP:
function QuickPickTheme()
{
global $txt, $db_prefix, $sc, $context, $modSettings, $user_info, $ID_MEMBER, $language;
checkSession('get');
loadLanguage('Profile');
loadTemplate('Themes');
$_SESSION['ID_THEME'] = 0;
if (isset($_GET['id']))
$_GET['th'] = $_GET['id'];
// Have we made a desicion, or are we just browsing?
if (isset($_GET['th']))
{
// Save for this user.
if (!isset($_REQUEST['u']) || !allowedTo('admin_forum'))
{
updateMemberData($ID_MEMBER, array('ID_THEME' => (int) $_GET['th']));
redirectexit('');
}
// For everyone.
elseif ($_REQUEST['u'] == '0')
{
updateMemberData(null, array('ID_THEME' => (int) $_GET['th']));
redirectexit('');
}
// Change the default/guest theme.
elseif ($_REQUEST['u'] == '-1')
{
updateSettings(array('theme_guests' => (int) $_GET['th']));
redirectexit('');
}
// Change a specific member's theme.
else
{
updateMemberData((int) $_REQUEST['u'], array('ID_THEME' => (int) $_GET['th']));
redirectexit('');
}
}
// Figure out who the member of the minute is, and what theme they've chosen.
if (!isset($_REQUEST['u']) || !allowedTo('admin_forum'))
{
$context['current_member'] = $ID_MEMBER;
$context['current_theme'] = $user_info['theme'];
}
// Everyone can't chose just one.
elseif ($_REQUEST['u'] == '0')
{
$context['current_member'] = 0;
$context['current_theme'] = 0;
}
// Guests and such...
elseif ($_REQUEST['u'] == '-1')
{
$context['current_member'] = -1;
$context['current_theme'] = $modSettings['theme_guests'];
}
// Someones else :P.
else
{
$context['current_member'] = (int) $_REQUEST['u'];
$request = db_query("
SELECT ID_THEME
FROM {$db_prefix}members
WHERE ID_MEMBER = $context[current_member]
LIMIT 1", __FILE__, __LINE__);
list ($context['current_theme']) = mysql_fetch_row($request);
mysql_free_result($request);
}
// Get the theme name and descriptions.
$context['available_themes'] = array();
if (!empty($modSettings['knownThemes']))
{
$knownThemes = implode("', '", explode(',', $modSettings['knownThemes']));
$request = db_query("
SELECT ID_THEME, variable, value
FROM {$db_prefix}themes
WHERE variable IN ('name', 'theme_url', 'theme_dir', 'images_url')" . (empty($modSettings['theme_default']) && !allowedTo('admin_forum') ? "
AND ID_THEME IN ('$knownThemes')
AND ID_THEME != 1" : '') . "
AND ID_THEME != 0
LIMIT " . count(explode(',', $modSettings['knownThemes'])) * 8, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
if (!isset($context['available_themes'][$row['ID_THEME']]))
$context['available_themes'][$row['ID_THEME']] = array(
'id' => $row['ID_THEME'],
'selected' => $context['current_theme'] == $row['ID_THEME'],
'num_users' => 0
);
$context['available_themes'][$row['ID_THEME']][$row['variable']] = $row['value'];
}
mysql_free_result($request);
}
// Okay, this is a complicated problem: the default theme is 1, but they aren't allowed to access 1!
if (!isset($context['available_themes'][$modSettings['theme_guests']]))
{
$context['available_themes'][0] = array(
'num_users' => 0
);
$guest_theme = 0;
}
else
$guest_theme = $modSettings['theme_guests'];
$request = db_query("
SELECT ID_THEME, COUNT(*) AS theCount
FROM {$db_prefix}members
GROUP BY ID_THEME DESC", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
// Figure out which theme it is they are REALLY using.
if ($row['ID_THEME'] == 1 && empty($modSettings['theme_default']))
$row['ID_THEME'] = $guest_theme;
elseif (empty($modSettings['theme_allow']))
$row['ID_THEME'] = $guest_theme;
if (isset($context['available_themes'][$row['ID_THEME']]))
$context['available_themes'][$row['ID_THEME']]['num_users'] += $row['theCount'];
else
$context['available_themes'][$guest_theme]['num_users'] += $row['theCount'];
}
mysql_free_result($request);
foreach ($context['available_themes'] as $ID_THEME => $theme_data)
{
// Don't try to load the forum or board default theme's data... it doesn't have any!
if ($ID_THEME == 0)
continue;
$settings = $theme_data;
$settings['theme_id'] = $ID_THEME;
if (file_exists($settings['theme_dir'] . '/languages/Settings.' . $user_info['language'] . '.php'))
include($settings['theme_dir'] . '/languages/Settings.' . $user_info['language'] . '.php');
elseif (file_exists($settings['theme_dir'] . '/languages/Settings.' . $language . '.php'))
include($settings['theme_dir'] . '/languages/Settings.' . $language . '.php');
else
{
$txt['theme_thumbnail_href'] = $settings['images_url'] . '/thumbnail.gif';
$txt['theme_description'] = '';
}
$context['available_themes'][$ID_THEME]['thumbnail_href'] = $txt['theme_thumbnail_href'];
$context['available_themes'][$ID_THEME]['description'] = $txt['theme_description'];
}
// As long as we're not doing the default theme...
if (!isset($_REQUEST['u']) || $_REQUEST['u'] >= 0)
{
if ($guest_theme != 0)
$context['available_themes'][0] = $context['available_themes'][$guest_theme];
$context['available_themes'][0]['id'] = 0;
$context['available_themes'][0]['name'] = $txt['theme_forum_default'];
$context['available_themes'][0]['selected'] = $context['current_theme'] == 0;
$context['available_themes'][0]['description'] = $txt['theme_global_description'];
}
ksort($context['available_themes']);
$context['page_title'] = &$txt['theme_pick'];
$context['sub_template'] = 'qpick';
}
language/Modifications.turkish.php yi aç
Bul
PHP:
?>
öncesine ekle
PHP:
$txt['qthemes'] = 'TEMALAR';
$txt['qthemeselect'] = 'Lütfen bir tema seçin';
language/Modifications.turkish-utf8.php yi aç
bul
PHP:
?>
öncesine ekle
PHP:
$txt['qthemes'] = 'TEMALAR';
$txt['qthemeselect'] = 'Lütfen bir tema seçin';
language/Modifications.english.php yi aça,
bul
PHP:
?>
öncesine ekle
PHP:
$txt['qthemes'] = 'THEMES';
$txt['qthemeselect'] = 'Please Select Theme';
language/Modifications.english-utf8.php yi aç
bul
PHP:
?>
öncesine ekle
PHP:
$txt['qthemes'] = 'THEMES';
$txt['qthemeselect'] = 'Please Select Theme';
theme/index.template.php yi aç
bul
PHP:
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
öncesine ekle
PHP:
//Added By Badboy
//Show Theme Picker ;)
echo '
<div class="tborder">
<div class="catbg" style="padding: 4px;">
<form action="', $scripturl, '" method="get" style="padding:0; margin: 0;">
<select name="jumpto" id="jumpto" onchange="if (this.selectedIndex > 0 && this.options[this.selectedIndex].value) window.location.href = smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl.indexOf(\'?\') == -1 || this.options[this.selectedIndex].value.substr(0, 1) != \'?\' ? 0 : 1);">
<optgroup style="background-color: #b0c4de;" label="' . $txt['qthemes'] . '"></optgroup>
<option style="background-color: #eee9e9;" value="">' . $txt['qthemeselect'] . '</option>';
$themes = getQuickThemeData();
foreach($themes as $theme)
{
if (!$context['user']['is_guest'])
{
echo '
<option value="?action=theme;sa=qpick;u=', $context['user']['id'] ,';th=', $theme['id'] ,';sesc=', $context['session_id'], '">=>' .$theme['name'] . '</option>';
}
else
{
echo '
<option value="?theme=', $theme['id'] ,'">=>' .$theme['name'] . '</option>';
}
}
echo '
</select>
</form>
</div>
</div><br />';
bul
PHP:
?>
öncesine ekle
PHP:
// This neat function finds and returns info about all of our themes.
function getQuickThemeData()
{
global $db_prefix, $user_info, $scripturl, $settings, $options, $modSettings;
$themes = array();
// Get all of our themes.
$request = db_query("
SELECT value, ID_THEME
FROM {$db_prefix}themes
WHERE variable = 'name'
AND ID_THEME != $settings[theme_id]" . (empty($modSettings['theme_default']) ? '
AND ID_THEME != 1' : '') . "
ORDER BY value", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$themes[] = array(
'id' => $row['ID_THEME'],
'name' => $row['value'],
);
}
return $themes;
}
board/Themes/babylon/index.template.php yi aç
bul
PHP:
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
öncesine ekle
PHP:
//Show Theme Picker ;)
echo '
<br /><center><div align="left" class="tborder" style="width: 95%;">
<table border="0" width="100%" cellspacing="1" cellpadding="5">
<tr>
<td class="catbg">
<form action="', $scripturl, '" method="get" style="padding:0; margin: 0;">
<select name="jumpto" id="jumpto" onchange="if (this.selectedIndex > 0 && this.options[this.selectedIndex].value) window.location.href = smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl.indexOf(\'?\') == -1 || this.options[this.selectedIndex].value.substr(0, 1) != \'?\' ? 0 : 1);">
<optgroup style="background-color: #b0c4de;" label="' . $txt['qthemes'] . '"></optgroup>
<option style="background-color: #eee9e9;" value="">' . $txt['qthemeselect'] . '</option>';
$themes = getQuickThemeData();
foreach($themes as $theme)
{
if (!$context['user']['is_guest'])
{
echo '
<option value="?action=theme;sa=qpick;u=', $context['user']['id'] ,';th=', $theme['id'] ,';sesc=', $context['session_id'], '">=>' .$theme['name'] . '</option>';
}
else
{
echo '
<option value="?theme=', $theme['id'] ,'">=>' .$theme['name'] . '</option>';
}
}
echo '
</select>
</form>
</td>
</tr>
</table>
</div></center><br />';
Bul
PHP:
?>
öncesine ekle
PHP:
// This neat function finds and returns info about all of our themes.
function getQuickThemeData()
{
global $db_prefix, $user_info, $scripturl, $settings, $options, $modSettings;
$themes = array();
// Get all of our themes.
$request = db_query("
SELECT value, ID_THEME
FROM {$db_prefix}themes
WHERE variable = 'name'
AND ID_THEME != $settings[theme_id]" . (empty($modSettings['theme_default']) ? '
AND ID_THEME != 1' : '') . "
ORDER BY value", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$themes[] = array(
'id' => $row['ID_THEME'],
'name' => $row['value'],
);
}
return $themes;
}
board/Themes/classic/index.template.php yi açın
bul
PHP:
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
öncesine ekle
PHP:
//Show Theme Picker ;)
echo '
<table cellspacing="0" cellpadding="0" border="0" align="center" width="95%" class="tborder">
<tr>
<td class="catbg" style="padding: 4px;">
<form action="', $scripturl, '" method="get" style="padding:0; margin: 0;">
<select name="jumpto" id="jumpto" onchange="if (this.selectedIndex > 0 && this.options[this.selectedIndex].value) window.location.href = smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl.indexOf(\'?\') == -1 || this.options[this.selectedIndex].value.substr(0, 1) != \'?\' ? 0 : 1);">
<optgroup style="background-color: #b0c4de;" label="' . $txt['qthemes'] . '"></optgroup>
<option style="background-color: #eee9e9;" value="">' . $txt['qthemeselect'] . '</option>';
$themes = getQuickThemeData();
foreach($themes as $theme)
{
if (!$context['user']['is_guest'])
{
echo '
<option value="?action=theme;sa=qpick;u=', $context['user']['id'] ,';th=', $theme['id'] ,';sesc=', $context['session_id'], '">=>' .$theme['name'] . '</option>';
}
else
{
echo '
<option value="?theme=', $theme['id'] ,'">=>' .$theme['name'] . '</option>';
}
}
echo '
</select>
</form>
</td>
</tr>
</table><br />';
Bul
PHP:
?>
öncesine ekle
PHP:
// This neat function finds and returns info about all of our themes.
function getQuickThemeData()
{
global $db_prefix, $user_info, $scripturl, $settings, $options, $modSettings;
$themes = array();
// Get all of our themes.
$request = db_query("
SELECT value, ID_THEME
FROM {$db_prefix}themes
WHERE variable = 'name'
AND ID_THEME != $settings[theme_id]" . (empty($modSettings['theme_default']) ? '
AND ID_THEME != 1' : '') . "
ORDER BY value", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$themes[] = array(
'id' => $row['ID_THEME'],
'name' => $row['value'],
);
}
return $themes;
}
board/Themes/dilbermc/index.template.php yi aç
bul
PHP:
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
öncesine ekle
PHP:
//Show Theme Picker ;)
echo '
<center><div align="left" class="tborder" style="width: 95%">
<div class="catbg" style="padding: 4px;">
<form action="', $scripturl, '" method="get" style="padding:0; margin: 0;">
<select name="jumpto" id="jumpto" onchange="if (this.selectedIndex > 0 && this.options[this.selectedIndex].value) window.location.href = smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl.indexOf(\'?\') == -1 || this.options[this.selectedIndex].value.substr(0, 1) != \'?\' ? 0 : 1);">
<optgroup style="background-color: #b0c4de;" label="' . $txt['qthemes'] . '"></optgroup>
<option style="background-color: #eee9e9;" value="">' . $txt['qthemeselect'] . '</option>';
$themes = getQuickThemeData();
foreach($themes as $theme)
{
if (!$context['user']['is_guest'])
{
echo '
<option value="?action=theme;sa=qpick;u=', $context['user']['id'] ,';th=', $theme['id'] ,';sesc=', $context['session_id'], '">=>' .$theme['name'] . '</option>';
}
else
{
echo '
<option value="?theme=', $theme['id'] ,'">=>' .$theme['name'] . '</option>';
}
}
echo '
</select>
</form>
</div>
</div></center><br />';
Bul
PHP:
?>
öncesine ekle
PHP:
// This neat function finds and returns info about all of our themes.
function getQuickThemeData()
{
global $db_prefix, $user_info, $scripturl, $settings, $options, $modSettings;
$themes = array();
// Get all of our themes.
$request = db_query("
SELECT value, ID_THEME
FROM {$db_prefix}themes
WHERE variable = 'name'
AND ID_THEME != $settings[theme_id]" . (empty($modSettings['theme_default']) ? '
AND ID_THEME != 1' : '') . "
ORDER BY value", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$themes[] = array(
'id' => $row['ID_THEME'],
'name' => $row['value'],
);
}
return $themes;
}