collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 635
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Sohbet Kutusu

Refresh History
  • Destek için kullanmay?n!
  • akorkut: Ama desteklerinizi de bekliyoruz.
    November 18, 2016, 08:41:36 AM
  • akorkut: grafitus hocam, yaklaşık 10 yıl.. smf, sp,  sizin ve diğer paylaşımseverin çalışmalarınızl bize destek oldu. Herşey için çok teşekkür ederiz.
    November 18, 2016, 08:40:38 AM
  • grafitus: Merhabalar herkese. Uzun zaman oldu, hayatlar değişti. Vakit ayıramaz olduk. SMF ve SimplePortal'ın yeri farklı olsa da artık aktif olmadıkları aşikar. Belki bir gün yeniden forumlar doğar. :)) Sevgilerle.
    November 18, 2016, 08:26:32 AM
  • tc bolubeyi: gelen giden yok pek
    July 31, 2016, 02:52:53 PM
  • tekniker974: Neredeyse 1 sene olmuş
    May 12, 2016, 01:05:50 AM
  • tekniker974: Günaydın
    May 12, 2016, 01:05:19 AM
  • tc bolubeyi: merhaba dostlara
    August 28, 2015, 08:56:04 AM
  • mert1i: ker alaka
    August 03, 2015, 10:07:49 AM
  • sonkalem: sa
    July 14, 2015, 03:27:51 PM
  • tc bolubeyi: sağolun ben de iyi allaha şükür
    June 10, 2015, 05:52:54 PM
  • mkuru: Teşekkürler Hasan Bey. Sizi sormalı
    May 27, 2015, 02:53:43 AM
  • tc bolubeyi: selam dostlar nasılsınız
    May 23, 2015, 06:52:15 PM
  • streetfire: Ben seviyorum.
    May 01, 2015, 03:39:22 PM
  • streetfire: Valla bilmiyorum. Sitemde çok kullanıyorum.
    May 01, 2015, 03:39:14 PM
  • mkuru: Evet haklısın
    April 03, 2015, 08:23:32 AM
  • mert1i: portalın en çok istenen ama en aaz talep gören kısmı bu chat
    April 01, 2015, 07:35:31 AM
  • mert1i: Selamun aleyküm ahali..
    January 27, 2015, 05:20:06 AM
  • tekniker974: a.s.
    August 12, 2014, 03:22:53 PM
  • delirium: S.a
    August 02, 2014, 10:24:22 AM
  • tekniker974: :nervous-happy:kimse yok
    July 15, 2014, 01:19:26 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Author Topic: Theme Box ( Tema Kutusu )  (Read 2864 times)

0 Members and 1 Guest are viewing this topic.

Offline Paragaya

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
  • Heyo Basit Portal :D
  • SMF Version: None
  • SP Version: None
Theme Box ( Tema Kutusu )
« on: March 30, 2009, 11:53:21 AM »
Php blok olu?turup içine bu kodu yerle?tirin :)


Code: [Select]
/*
This is a small Theme Picker.
Version 1.1.0 (19.11.08)
Tested only on SMF 1.1.x
*/

//Settings Start here, they are all checked, and disable itself it it not usefull to disable it ;P

//This will show the Submit button, this is only for user who disable the Javascript, if you don't like it you can remove it by set it to 0
$showSubmitButton = 1;
//Auto Remove the button if Java Script avaible and enabled and the button is shown
$autoRemoveButton = 1;
//Disable the Java Script? 0 = No, 1 = Yes!
$autoSubmitThemeChange = 0;
//Enable the Images? Disable the autoSubmitThemeChange for this! Only one of them will work ;)
$showPreviewImages = 1;
//Change Theme Text for the Button
$txt['sp_ThemeChange_submit'] = 'Mudar de Skin';

//Here start the script :D and you know if you not know what you do do nothing after this ;)
global $modSettings, $context, $db_prefix, $settings, $txt, $ID_MEMBER, $scripturl, $user_info;

//Checkup Settings :) Fix them so that it work ;)
$autoSubmitThemeChange = !empty($autoSubmitThemeChange);
$showPreviewImages = !empty($showPreviewImages);
$showSubmitButton = $showPreviewImages || !empty($showSubmitButton) || !$autoSubmitThemeChange;
$autoRemoveButton = $showSubmitButton && $autoSubmitThemeChange && !empty($autoRemoveButton);
$txt['sp_ThemeChange_submit'] = empty($txt['sp_ThemeChange_submit']) ? 'Mudar de Skin' : $txt['sp_ThemeChange_submit'];

//Load the Themerelated Language Things :)
loadLanguage('Profile');

// Load the themes for pull down list
$request = db_query("
SELECT ID_THEME, variable, value
FROM {$db_prefix}themes
WHERE variable IN ('name', 'theme_dir', 'theme_url', 'images_url')
AND ID_MEMBER = 0", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request))
{
if (!isset($context['themes'][$row['ID_THEME']]))
$context['themes'][$row['ID_THEME']] = array(
'id' => $row['ID_THEME'],
);
$context['themes'][$row['ID_THEME']][$row['variable']] = $row['value'];
}
mysql_free_result($request);

//Let's see if i should update the theme on the userdata?
if(isset($_REQUEST['th']) && is_numeric($_REQUEST['th'])) {
checkSession('get');
$_REQUEST['th'] = (int) $_REQUEST['th'];
//Fall back to default?
if(empty($context['themes'][$_REQUEST['th']]))
$_REQUEST['th'] = -1;
if(!$context['user']['is_guest'])
updateMemberData($ID_MEMBER, array('ID_THEME' => ($_REQUEST['th'] == -1 ? 0 : $_REQUEST['th'])));
redirectexit('theme='.$_REQUEST['th']);
}

//Load the current user theme, could be possible updated ;)
if(!$context['user']['is_guest']) {
$request = db_query("
SELECT ID_THEME
FROM {$db_prefix}members
WHERE ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);
list ($context['current_theme']) = mysql_fetch_row($request);
mysql_free_result($request);
}
else
$context['current_theme'] = 0; //Only for guest ;)

//Enable the Image Thumbnails?
$context['current_theme_thumb'] = '';
if($showPreviewImages) {
foreach ($context['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['themes'][$ID_THEME]['thumbnail_href'] = $txt['theme_thumbnail_href'];
$context['themes'][$ID_THEME]['description'] = $txt['theme_description'];
}

//Default Theme need an thumnail :D (Hope this work :X)
$context['themes'][0]['thumbnail_href'] = !empty($context['themes'][$modSettings['theme_default']]['thumbnail_href']) ? $context['themes'][$modSettings['theme_default']]['thumbnail_href'] : $context['themes'][1]['thumbnail_href'];
//Standardthumb :x
$context['current_theme_thumb'] = $context['themes'][0]['thumbnail_href'];
}

//Default Theme :)
$context['themes'][0]['id'] = 0;
$context['themes'][0]['name'] = $txt['theme_forum_default'];
$context['themes'][0]['description'] = $txt['theme_global_description'];

//Sort it ;)
ksort($context['themes']);

//The Java Script Parts :) Only this or the other not both :O
if($autoSubmitThemeChange)
{
echo '
<script language="JavaScript" type="text/javascript">
function sportal_theme_change(obj)
{
var id = obj.options[obj.selectedIndex].value;
var url = new String(window.location);
loc = \'index.php?th=\' + id + \';sesc=', $context['session_id'], '\';
window.location = loc;
}
</script>';
}
elseif($showPreviewImages)
{
echo '
<script language="JavaScript" type="text/javascript">
var sp_smf_thumb_link_array = new Array();';
foreach($context['themes'] as $key => $item)
echo '
sp_smf_thumb_link_array['.$key.'] = "' . $item['thumbnail_href'] . '";';
echo '
function sportal_theme_change(obj)
{
var id = obj.options[obj.selectedIndex].value;
document.getElementById("sp_theme_thumbnail").src = sp_smf_thumb_link_array[id];
}
</script>';
}


//And the pulldown
echo '
<form>
<div style="text-align: center; width:99%;">
<select name="th"' . ($autoSubmitThemeChange || $showPreviewImages ? ' onchange="sportal_theme_change(this)"' : '') . ' style="width:95%;">';
foreach ($context['themes'] as $theme)
{
if($showPreviewImages && $context['current_theme'] == $theme['id'])
$context['current_theme_thumb'] = $theme['thumbnail_href'];
echo '
<option value="', $theme['id'], '"', ($context['current_theme'] == $theme['id'] ? ' selected="selected"' : ''), '>', $theme['name'], '</option>';
}
echo '
</select>' . ($showPreviewImages ? '
<img style="padding:5px 5px 5px 5px" id="sp_theme_thumbnail" src="'.$context['current_theme_thumb'].'" />' : '') . ($showSubmitButton ? '
<input type="hidden" name="sesc" value="' . $context['session_id'] . '" />
<input style="display:inline;" id="sp_theme_changer_submitt_button" type="submit" value="' . $txt['sp_ThemeChange_submit'] . '" name="submit" />
' : '') . '
</div>
</form>';

//Autoremove the Button?
if($autoRemoveButton)
{
echo '
<script language="JavaScript" type="text/javascript">
document.getElementById("sp_theme_changer_submitt_button").style.display = "none";
</script>';
}


Yap?mc? : Costa , Orjinal konu
« Last Edit: April 01, 2009, 03:53:10 AM by Paragaya »

Offline Yağız...

  • Jr. Member
  • **
  • Posts: 80
  • Gender: Male
Re: Theme Box ( Tema Kutusu )
« Reply #1 on: March 30, 2009, 11:59:23 AM »
Yakında SP 2.2 çıkınca buna gerek kalmayacak.

Offline Paragaya

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
  • Heyo Basit Portal :D
  • SMF Version: None
  • SP Version: None
Re: Theme Box ( Tema Kutusu )
« Reply #2 on: March 30, 2009, 12:01:27 PM »
Ewt Admin Panelinde gördüm kendinden Vardı ;)