Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Fustrate on August 19, 2008, 11:29:32 PM

Title: Simple Theme Changer
Post by: Fustrate on August 19, 2008, 11:29:32 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1342)



Simple Theme Changer v1.0



Introduction
Simple Theme Changer allows users to switch themes from any page, without having to go to their profile - all you have to do is pick one from a dropdown list!

Features
o A dropdown box is placed in the bottom right side of most themes' footers. If it doesn't show up in your theme, add the following where you want it to appear (in index.template.php):
echo '
<select id="simple_theme_changer" onchange="switch_theme();">
<optgroup label="', $txt['simple_theme_changer_name'], '">';

foreach ($context['themes'] as $id => $theme)
echo '
<option value="', $id, '"', (($settings['theme_id'] == $id) ? ' selected="selected"' : ''), '>', $theme, '</option>';

echo '
</optgroup>
</select>

<script language="JavaScript" type="text/javascript">
<!--
function switch_theme(){
theme_changer = document.getElementById("simple_theme_changer");
var id = theme_changer.options[theme_changer.selectedIndex].value;
var page = new String(window.location);

window.location = "index.php?action=theme;sa=pick;type=quick;u=', $context['user']['id'] ,';th=" + id + ";sesc=', $context['session_id'], ';page=" + escape(page);
return false;
}
-->
</script>';

o To use this mod, just pick a theme from the dropdown menu ;)
o There are NO admin features for this modification.


Support
Please use the modification thread for support with this modification. Personal messages for support are discouraged.

Languages
o English
o English UTF-8
If you have any translations for any other languages, I would be grateful if you would send them to me via PM or in the Mods topic.

Changelog
> Comment
+ Addition
- Error/bug fix

Version 1.0 Aug. 16th, 2008
> Initial Release

(No Version Change) 12th February, 2009
> Upgraded for RC1, 1.1.x support added.
Title: Re: Simple Theme Changer
Post by: Nathaniel on August 19, 2008, 11:38:54 PM
Wow, very nice little mod! :D

I have seen this sort of thing around quite a few different theme demo sites. ;)
Title: Re: Simple Theme Changer
Post by: Fustrate on August 19, 2008, 11:41:26 PM
ya, and there was a mod that was last updated... some time last year? But as far as I could tell there wasn't one for 2.0 :P
Title: Re: Simple Theme Changer
Post by: .HuNTeR. on August 20, 2008, 01:38:27 PM
if you write a version for 1.1.5 it will be great
Title: Re: Simple Theme Changer
Post by: Nathaniel on August 20, 2008, 05:16:01 PM
[sarcasm]

Hmm, just thinking aloud, anyway of making this use Ajax to change the theme? ;D

[/sarcasm]
Title: Re: Simple Theme Changer
Post by: Dark-Wizard on September 01, 2008, 04:21:57 PM
Where in the Index.template.php am i supposed to put the code?
Title: Re: Simple Theme Changer
Post by: Fustrate on September 01, 2008, 05:30:53 PM
It really depends on your theme... sometimes you can go to
</div>';
}

function template_html_below()


and replace it with
<select id="simple_theme_changer" onchange="switch_theme();">
   <optgroup label="', $txt['simple_theme_changer_name'], '">';

foreach ($context['themes'] as $theme)
   echo '
      <option value="', $theme['id'], '"', (($settings['theme_id'] == $theme['id']) ? ' selected="selected"' : ''), '>', $theme['name'], '</option>';

echo '
   </optgroup>
</select>

<script language="JavaScript" type="text/javascript">
   <!--
   function switch_theme(){
      theme_changer = document.getElementById('simple_theme_changer');
      var id = theme_changer.options[theme_changer.selectedIndex].value;
      var page = new String(window.location);

      window.location', $context['browser']['is_safari'] ? '.href' : '', ' = 'index.php?action=theme;sa=pick;type=quick;u=', $context['user']['id'] ,';th=' + id + ';sesc=', $context['session_id'], ';page=' + escape(page);
   }
   -->
</script>
</div>';
}

function template_html_below()
Title: Re: Simple Theme Changer
Post by: Dark-Wizard on September 01, 2008, 05:50:32 PM
That gave me errors :( is there by chance i can send you the files?
Title: Re: Simple Theme Changer
Post by: Fustrate on September 01, 2008, 05:53:40 PM
Sure, just attach it here
Title: Re: Simple Theme Changer
Post by: Dark-Wizard on September 01, 2008, 06:04:25 PM
1. Mystic Jade
2. BacknBlack
3. ClanWar
4. OverView

Please return them in the same order and thank you! :p i love your mods <.<
Title: Re: Simple Theme Changer
Post by: Fustrate on September 01, 2008, 06:22:16 PM
Argh, I really have to leave...

try placing this right before the ending bracket (}) of template_body_below, right after the </div>';

echo '
<select id="simple_theme_changer" onchange="switch_theme();">
   <optgroup label="', $txt['simple_theme_changer_name'], '">';

foreach ($context['themes'] as $theme)
   echo '
      <option value="', $theme['id'], '"', (($settings['theme_id'] == $theme['id']) ? ' selected="selected"' : ''), '>', $theme['name'], '</option>';

echo '
   </optgroup>
</select>

<script language="JavaScript" type="text/javascript">
   <!--
   function switch_theme(){
      theme_changer = document.getElementById(\'simple_theme_changer\');
      var id = theme_changer.options[theme_changer.selectedIndex].value;
      var page = new String(window.location);

      window.location', $context['browser']['is_safari'] ? '.href' : '', ' = \'index.php?action=theme;sa=pick;type=quick;u=', $context['user']['id'] ,';th=\' + id + \';sesc=', $context['session_id'], ';page=\' + escape(page);
   }
   -->
</script>';


make sure it's AFTER the '; and before the }

and sorry about having to leave... I had no clue I was going to a Dodger game tonight
Title: Re: Simple Theme Changer
Post by: Dark-Wizard on September 01, 2008, 06:37:22 PM
I still keep getting the same error :( may you attempt it when you return?
Title: Re: Simple Theme Changer
Post by: Dark-Wizard on September 05, 2008, 04:55:54 PM
I still cant get it right :(
Title: Re: Simple Theme Changer
Post by: Fustrate on September 05, 2008, 05:18:37 PM
attach your index.template.php to a post
Title: Re: Simple Theme Changer
Post by: Dark-Wizard on September 05, 2008, 05:21:01 PM
I already did. its one of the posts above.
Title: Re: Simple Theme Changer
Post by: Fustrate on September 05, 2008, 05:26:37 PM
Oi, you're the one with 4...

Follow the example in this one, it's the first of the 4 themes:
Title: Re: Simple Theme Changer
Post by: Dark-Wizard on September 05, 2008, 05:31:53 PM
Thank you :P and my site is www.thefinalgathering.co.cc <.< check it out some time XD and ill be putting in the file as soon as i return back home.
Title: Re: Simple Theme Changer
Post by: Darkness_ on September 09, 2008, 04:48:25 PM
what do I have to do, when I don't let a theme in that list?
something like, I want ID: 1, 2, 3, 5, 8
Maybe an array or something?
Title: Re: Simple Theme Changer
Post by: Fustrate on September 09, 2008, 05:53:30 PM
If you only want certain themes, find this in index.template.php:
foreach ($context['themes'] as $theme)

and add this right after it:
if(in_array($my_themes, $theme['id']))

and right before the foreach(), on the line before it add:
$my_themes = array(1,2, 3, 5, 8);
Title: Re: Simple Theme Changer
Post by: Darkness_ on September 10, 2008, 06:42:58 AM
BTW: could't this theme be compatible with the 1.1.X version of SMF.
I could help if you want.
Title: Re: Simple Theme Changer
Post by: Fustrate on September 10, 2008, 10:21:00 AM
there is already a mod that does this for 1.1.x... can't remember the exact name though
Title: Re: Simple Theme Changer
Post by: Goodman854 on September 17, 2008, 07:45:44 PM
THERE IS? WHATS IT CALLED? Cause I don't see it lol.
Title: Re: Simple Theme Changer
Post by: Fustrate on September 17, 2008, 08:04:07 PM
http://custom.simplemachines.org/mods/index.php?mod=746
Title: Re: Simple Theme Changer
Post by: K3TK3TK3T on September 24, 2008, 05:39:54 PM
will you update this please?

thanks
Title: Re: Simple Theme Changer
Post by: Fustrate on September 24, 2008, 08:08:49 PM
Ya, it's on my list. Long list ;)
Title: Re: Simple Theme Changer
Post by: Nibogo on September 30, 2008, 10:11:02 PM
Spanish_latin:

$txt['simple_theme_changer_name'] = 'Elegir Tema';
Title: Re: Simple Theme Changer
Post by: Fustrate on September 30, 2008, 10:31:53 PM
Thanks :) Is that also usable for the other spanish_* language files?
Title: Re: Simple Theme Changer
Post by: Nibogo on September 30, 2008, 10:36:20 PM
Quote from: YodaOfDarkness on September 30, 2008, 10:31:53 PM
Thanks :) Is that also usable for the other spanish_* language files?

Yes ;)
Title: Re: Simple Theme Changer
Post by: K3TK3TK3T on November 22, 2008, 11:07:24 PM
ah!!!! update this!! lol
Title: Re: Simple Theme Changer
Post by: Fustrate on November 23, 2008, 03:00:25 AM
Real life takes precedence  :-X

I'm probably going to update all of my mods after RC1 comes out, for my own sanity.
Title: Re: Simple Theme Changer
Post by: evil-angelist on November 23, 2008, 03:16:20 AM
.
Title: Re: Simple Theme Changer
Post by: Fustrate on November 23, 2008, 05:12:09 AM
Quote from: evil-angelist on November 23, 2008, 03:16:20 AM
.
Thank you, I'll keep that in mind ;)
Title: Re: Simple Theme Changer
Post by: evil-angelist on November 23, 2008, 07:58:31 AM
Quote from: YodaOfDarkness on November 23, 2008, 05:12:09 AM
Quote from: evil-angelist on November 23, 2008, 03:16:20 AM
.
Thank you, I'll keep that in mind ;)

If SMF had bookmarks here...
Title: Re: Simple Theme Changer
Post by: KahneFan on December 24, 2008, 02:25:06 AM
Quote from: evil-angelist on November 23, 2008, 07:58:31 AM
If SMF had bookmarks here...

"Notify"?
Title: Re: Simple Theme Changer
Post by: Xepernas on February 13, 2009, 12:06:26 PM
Extremely welcome mod.

I have a question about :

Quote from: Fustrate on September 09, 2008, 05:53:30 PM
If you only want certain themes, find this in index.template.php:
foreach ($context['themes'] as $theme)

and add this right after it:
if(in_array($my_themes, $theme['id']))

and right before the foreach(), on the line before it add:
$my_themes = array(1,2, 3, 5, 8);

Is there some code I could type there to make the mod automatically check if a theme is enabled ?

See, I haven't tagged all themes in the "Themes that the user is able to select" page of SMF's Themes and Layout Settings, yet all of them appear in the mod's dropdown menu. Is manually adding/removing themes id the only way to keep the droplist coherent with the enabled themes ?
Title: Re: Simple Theme Changer
Post by: Fustrate on February 13, 2009, 03:33:15 PM
I'll do that tonight or tomorrow, thanks for pointing that out.
Title: Re: Simple Theme Changer
Post by: Xepernas on February 22, 2009, 07:35:58 AM
Say, news on that ?

I'll have to manually add the code to many themes (aka: destroy our forum), but I've been waiting for the manual code to be updated.

Please warn me if it won't be, I'll just use it as it is now.
Title: Re: Simple Theme Changer
Post by: Fustrate on February 22, 2009, 09:31:19 PM
in index.php, find:
// Simple Theme Changer
$request = $smcFunc['db_query']('', '
SELECT *
FROM {db_prefix}themes
WHERE variable = {string:name}
AND id_member = 0',
array('name' => 'name')
);

$context['themes'] = array();

while ($row = $smcFunc['db_fetch_assoc']($request))
$context['themes'][$row['id_theme']] = $row['value'];

$smcFunc['db_free_result']($request);
// End Simple Theme Changer


and replace it with

// Make our known themes a little easier to work with.
$enabled_themes = !empty($modSettings['knownThemes']) ? explode(',',$modSettings['knownThemes']) : array();

// Simple Theme Changer
$request = $smcFunc['db_query']('', '
SELECT *
FROM {db_prefix}themes
WHERE variable = {string:name}
AND id_member = 0',
array('name' => 'name')
);

$context['themes'] = array();

while ($row = $smcFunc['db_fetch_assoc']($request))
if(in_array($row['id_theme'], $enabled_themes))
$context['themes'][$row['id_theme']] = $row['value'];

unset($enabled_themes);

$smcFunc['db_free_result']($request);
// End Simple Theme Changer


and see if that works.
Title: Re: Simple Theme Changer
Post by: Quexinos on February 23, 2009, 04:21:31 AM
Sorry but does this work on 2.0 4 beta?....

I only currently have one skin but...
Title: Re: Simple Theme Changer
Post by: Fustrate on February 23, 2009, 11:22:49 AM
Yes it should.
Title: Re: Simple Theme Changer
Post by: KahneFan on March 02, 2009, 12:40:53 AM
Frustrate, great mod! I have two questions in regards to making this compatible with two other mods.

1) Global Headers and Footers Mod (http://custom.simplemachines.org/mods/index.php?mod=351)
What would the HTML code be to make this work with the global headers/footers mod? If this could be used with GHF then it would be automatically on every theme no matter what since GHF works across themes. It seems pretty straight forward, I just can't seem to figure out how to make it work on plain HTML.

2) I tried adding your code to a SimplePortal PHP block and it gave me the drop down OK, but no theme names were listed for some reason. Any idea on how to make that work? Again, this would be a way to make it work across all current and future themes.

Any help is appreciated.
Title: Re: Simple Theme Changer
Post by: Fustrate on March 02, 2009, 12:48:18 AM
did you do the index.php code too? That's what loads the theme names... and I've never actually tried the GHF mod, so I have no clue what to do.
Title: Re: Simple Theme Changer
Post by: KahneFan on March 02, 2009, 12:50:37 AM
index.php code? I used the code that you posted to apply wherever I wanted it to appear.

As for GHF it reads plain HTML, so if this can be coded in html... ?
Title: Re: Simple Theme Changer
Post by: KahneFan on March 02, 2009, 11:32:26 PM
I received an answer on how to add it to SP here: http://simpleportal.net/index.php?topic=1607.msg10652#msg10652
Title: Re: Simple Theme Changer
Post by: bullbreedluverz on March 17, 2009, 11:53:43 AM
hi, id like this mod to work for guests and not just for members, can the code be changed to allow guests to use the theme changer? if so what edits need to be made please
Title: Re: Simple Theme Changer
Post by: KahneFan on March 17, 2009, 12:05:08 PM
Good catch, I never even tested it as a gust. Definitely would be helpful.
Title: Re: Simple Theme Changer
Post by: bullbreedluverz on March 17, 2009, 12:10:18 PM
Quote from: KahneFan on March 17, 2009, 12:05:08 PM
Good catch, I never even tested it as a gust. Definitely would be helpful.

it is if you got themes you want to show off to people as they dont have to log in then
Title: Re: Simple Theme Changer
Post by: KahneFan on March 17, 2009, 12:13:12 PM
For now I've just put a notice with login info in the block I added to SimplePortal. You can see it on the top left of my home page.
Title: Re: Simple Theme Changer
Post by: islam2hamy on March 26, 2009, 01:45:43 AM
Thank you , very good mod ,

Arabic translation :


    <file name="$languagedir/Modifications.arabic-utf8.php" error="skip">
        <operation>
            <search position="end"></search>
            <add><![CDATA[

$txt['simple_theme_changer_name'] = 'تغيير القالب (الإستايل)';
]]></add>
        </operation>
    </file>


please before put the translation in the file be sure that the file encode is UTF-8
Title: Re: Simple Theme Changer
Post by: Afro on April 08, 2009, 09:35:16 AM
Quote from: stikkki on March 17, 2009, 11:53:43 AM
hi, id like this mod to work for guests and not just for members, can the code be changed to allow guests to use the theme changer? if so what edits need to be made please

any news on this,

mine installd fine but it takes members to their profiles when thry select a new theme.
is that normal or fault?
Title: Re: Simple Theme Changer
Post by: Fustrate on April 08, 2009, 02:30:12 PM
Try upgrading to this one... I'm pretty sure it'll fix everything (and allow guest to change themes, and only show enabled themes)
Title: Re: Simple Theme Changer
Post by: Afro on April 08, 2009, 06:08:33 PM
Thanks , i tried installing the new one but it stoped loading the themes automatically, i had to switch back to the old one.

how do you set the enabled themes,
i have three themes installed and all of them are showing there

www.afrowall.com
Title: Re: Simple Theme Changer
Post by: Fustrate on April 08, 2009, 06:27:24 PM
for the new version, you needed to do a hard refresh... ctrl-shift-r or cmd-shift-r because the javascript that switches it is now in an external script file.

Title: Re: Simple Theme Changer
Post by: bullbreedluverz on April 15, 2009, 11:31:34 AM
ive tried installing the new version on 2.0 rc1 and the themes dont change - ive done the hard refresh and had no errors on install
Title: Re: Simple Theme Changer
Post by: Fustrate on April 15, 2009, 10:07:12 PM
go to /Themes/default/scripts/script.js and check if there is a theme function at the end of it.
Title: Re: Simple Theme Changer
Post by: jellie on April 30, 2009, 04:10:00 AM
I have the same thing, the drop down box is there but no matter which theme I choose it doesn't change.

I have checked the script.js file and the theme function is there at the end of it.

I'm using 1.1.8 and default theme.
Title: Re: Simple Theme Changer
Post by: Fustrate on April 30, 2009, 11:43:53 AM
Have you done a hard refresh (shift-ctrl-r or shift-cmd-r)? If that doesn't work, can you PM me a link to your forum so I can test it out?
Title: Re: Simple Theme Changer
Post by: sixthofmay on May 12, 2009, 12:23:28 AM
Quote from: jellie on April 30, 2009, 04:10:00 AM
I have the same thing, the drop down box is there but no matter which theme I choose it doesn't change.

I have checked the script.js file and the theme function is there at the end of it.

I'm using 1.1.8 and default theme.

I tried this mod about two weeks ago on a new install and ran into the same issue with v1.1.8. I didn't have Pretty URLs installed yet, so that couldn't have been the issue. I didn't know about the hard refresh, so don't know if that would have cured it. I ended up using the older SMF Quick Theme Changer, and rewrote parts of it to get it to work properly and how I wanted (alpha sort, and with a reset to board defaults option, and working with Pretty URLs too). See page 4 of that mod's thread.

Oh the redirect to the user profile affected that mod too, which was solved.

Fustrate, take a look at how that mod works, might help you track down any issues with yours.
Title: Re: Simple Theme Changer
Post by: Moto on May 12, 2009, 01:41:44 PM
All i get is a drop down with

Array
Array
Array
Array

no themes to select????

any help would be fantastic..
Title: Re: Simple Theme Changer
Post by: neteater on July 03, 2009, 05:15:35 AM
does it work 2.0rc1-1
Title: Re: Simple Theme Changer
Post by: Lord Feste on July 12, 2009, 03:04:46 PM
Quote from: neteater on July 03, 2009, 05:15:35 AM
does it work 2.0rc1-1

No. I Just tried installing the package, it's not compatible with SMF 2.0 RC1-1 .
Title: Re: Simple Theme Changer
Post by: Sirius on July 23, 2009, 08:40:49 AM
is there any ways to make this mod to work on RC2-1 without having to edit some php codes?  that would be nice.   
 
Title: Re: Simple Theme Changer
Post by: Fustrate on July 23, 2009, 06:48:52 PM
on the bottom right of the page that lists your uploaded packages, look for a box that says something about Emulate Version, and change it to plain 2.0
Title: Re: Simple Theme Changer
Post by: Lord Feste on July 25, 2009, 05:48:45 PM
That does work, kind of. The changer drop down appears in the bottom right of the standard theme, but clicking on a different theme doesn't refresh the page, and there's no select button either?

Title: Re: Simple Theme Changer
Post by: robinrobin on July 28, 2009, 08:28:52 PM
This seems to be the only mod of this kind for SMF 2. Some support for using it in RC1.2 would be highly appreciated!
Title: My Simple Theme Changer 1.0.1 dont work
Post by: replay on August 03, 2009, 02:25:37 PM
i have installed tis packageand when you try to use them themes installed listed in Simple Theme Changer 1.0.1  and i click on a theme, thenthey jst dont work.

is there sme kinda edit i need to do, if so what is it i need to edit to getthis to work, or is there a theme changing program that does work on 1.1.10 SMF

Cheers
Title: Re: Simple Theme Changer
Post by: replay on August 03, 2009, 02:53:46 PM
do i add this code in the main index file located in themes, if so i tried it and it didn`t work ?

Title: Re: Simple Theme Changer
Post by: Fustrate on August 03, 2009, 03:25:56 PM
I'm working on a better version, javascript is kicking my butt though :P
Title: Re: Simple Theme Changer
Post by: replay on August 04, 2009, 09:36:25 AM
ok Fustrate, cheers for that,....i will wait for a much better version written by you.

Cheers
Title: Re: Simple Theme Changer
Post by: Fustrate on August 04, 2009, 10:39:16 AM
expect it in about 7 hours when I get back from work.
Title: Re: Simple Theme Changer
Post by: robinrobin on August 04, 2009, 11:03:11 AM
Now? lol ;)
Title: Re: Simple Theme Changer
Post by: Fustrate on August 04, 2009, 11:38:38 AM
6.5 hours :( I'm at work, and don't have access to one of the things I need
Title: Re: Simple Theme Changer
Post by: replay on August 04, 2009, 04:54:07 PM
its ok,...dont rush,...when your ready really :)

Cheers

Title: Re: Simple Theme Changer
Post by: Fustrate on August 04, 2009, 08:03:36 PM
Sorry bout the lateness, I can't say why it's late though =\ I had other things that had to be dealt with.

Try upgrading with this package
Title: Re: Simple Theme Changer
Post by: replay on August 05, 2009, 09:27:47 AM
have you tested it on 1.1.10 as it dont seem to work on mine.

cheers
Title: Re: Simple Theme Changer
Post by: anakmacan on August 18, 2009, 01:43:02 AM
I found an error on smf 1.1.8:

Not Acceptable

An appropriate representation of the requested resource /forum/index.php could not be found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


I use simpleportal and ive tried the code given in simpleportal but still got the same error. My forum is http://bincangprofesi.com/forum/index.php?action=forum
Title: Re: Simple Theme Changer
Post by: anakmacan on August 18, 2009, 07:57:36 PM
Nvm, the javascript cause trouble too that i couldnt add bb code and smiley in post. This should be great mod though :)
Title: Re: Simple Theme Changer
Post by: Rumbaar on November 18, 2009, 06:52:56 PM
Hi, nice mod.  I've got it working okay on 2.0RC2 (I moved it to the top of the Curve theme just under the news).  But is there a method or option I can added that changes the person's selected theme to their permanently selected theme.  Just like that had selected it via their profile?

It's okay for guest to have it current session based, but I'd like it to be permanent for logged in users.  To override the boards default board in other words.
Title: Re: Simple Theme Changer
Post by: david090366 on November 25, 2009, 10:49:14 PM
Was just wondering if you were aware that, at least in 1.1.10, the package double installs the mod so you have two drop downs, one on top of the other. It is easily resolved by simply removing the second drop down it installs in the index.template however.

This is the bit it adds twice.

<tr>
<td colspan="3" style="text-align: right;">
<select id="simple_theme_changer" onchange="switch_theme();">
<optgroup label="', $txt['simple_theme_changer_name'], '">';

foreach ($context['themes'] as $id => $theme)
echo '
<option value="', $id, '"', (($settings['theme_id'] == $id) ? ' selected="selected"' : ''), '>', $theme, '</option>';

echo '
</optgroup>
</select>
</td>
</tr>
Title: Re: Simple Theme Changer
Post by: Sirius on November 28, 2009, 01:04:00 AM
Quote from: Rumbaar on November 18, 2009, 06:52:56 PM
Hi, nice mod.  I've got it working okay on 2.0RC2 (I moved it to the top of the Curve theme just under the news). 

:'(  I wish i would be able to do that on my RC2 ..  I'll try again but I am afraid to edit the codes on my main forum..   I'm really not good at this .  This mod should be a feature of SMF2...... 80% of the members don't change their themes because they have a hard time to find out how to do it.. ( mostly old timers over 50 years old )   

so if I simply upload and try to install the package , it won't work key ?

Title: Re: Simple Theme Changer
Post by: Xepernas on December 18, 2009, 07:38:31 AM
Any news on that ? Is it officially compatible with 2.0RC2, or is anyone working for a practical theme changer for 2.0RC2 ?
Title: Re: Simple Theme Changer
Post by: scimmiotto on December 27, 2009, 11:55:51 AM
up, for rc2 ?
Title: Re: Simple Theme Changer
Post by: kingkingston on December 27, 2009, 12:11:55 PM
Quote from: scimmiotto on December 27, 2009, 11:55:51 AM
up, for rc2 ?
Don't think it is yet
Title: Re: Simple Theme Changer
Post by: ~DS~ on January 06, 2010, 03:45:42 PM
Quote from: kingkingston on December 27, 2009, 12:11:55 PM
Quote from: scimmiotto on December 27, 2009, 11:55:51 AM
up, for rc2 ?
Don't think it is yet
Any other alternative? since this one does not compatible with RC2 yet.
Title: Re: Simple Theme Changer
Post by: kingkingston on January 06, 2010, 04:54:18 PM
Quote from: Dismal Shadow on January 06, 2010, 03:45:42 PM
Quote from: kingkingston on December 27, 2009, 12:11:55 PM
Quote from: scimmiotto on December 27, 2009, 11:55:51 AM
up, for rc2 ?
Don't think it is yet
Any other alternative? since this one does not compatible with RC2 yet.
You already have one on your website,Simple portal provides one
Title: Re: Simple Theme Changer
Post by: anakmacan on January 14, 2010, 06:16:30 AM
Hello.. great mod, and thanks for it : ]

I have a question.. how do i put text like adding "Choose Another Theme" above the dropdown box ?

thx in advance : ]
Title: Re: Simple Theme Changer
Post by: Quexinos on February 16, 2010, 04:39:58 AM
Okay I installed it for RC 2.0 and I get this error when I try to change themes:
QuoteForbidden

You don't have permission to access /tnc/index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Anyone know what the deal is?
Title: Re: Simple Theme Changer
Post by: berker1907 on July 17, 2010, 09:10:41 PM
up for rc3?
Title: Re: Simple Theme Changer
Post by: cybergeneral on August 27, 2010, 02:10:41 PM
Quote from: berker1907 on July 17, 2010, 09:10:41 PM
up for rc3?

RC2 or RC3 pleaseee!  :)
Title: Re: Simple Theme Changer
Post by: Darkness_ on August 28, 2010, 08:22:37 AM
Can we do the same with this.
But instead of changing the theme, changing the style.css (multicolored theme)
Title: Re: Simple Theme Changer
Post by: steve51184 on November 23, 2010, 11:30:14 AM
anything like this for rc2/rc3/rc4?
Title: Re: Simple Theme Changer
Post by: Adrek on December 20, 2010, 04:30:31 PM
can someone update this for RC4 ?
Title: Re: Simple Theme Changer
Post by: Quexinos on February 11, 2011, 07:15:02 AM
Uhm Im trying to parse the mod on the ... well page the mod is on, but when I select 2.0 RC1, 2.0 RC1.2 it says it's not compatible with those two but it's listed that it is... anyone know what's up with that?
Title: Re: Simple Theme Changer
Post by: Hj Ahmad Rasyid Hj Ismail on April 24, 2011, 04:59:12 AM
I think it should work with any 2.0 RCx version. You just need to modify the package-info.xml in the package a bit and repackage it. Just modify the part of the available one to this:
<install for="2.*">
<readme type="file" parsebbc="true">readme.txt</readme>
<modification>install_2-0.xml</modification>
<modification>languages.xml</modification>
</install>

<uninstall for="2.*">
<readme type="inline">I'm sorry that things didn't work out between us... we can still be friends though!</readme>
<modification reverse="true">install_2-0.xml</modification>
<modification reverse="true">languages.xml</modification>
</uninstall>

<upgrade from="1.0" for="2.*">
<readme type="file" parsebbc="true">readme.txt</readme>
<modification>upgrade_2-0.xml</modification>
</upgrade>

<upgrade from="1.0.1" for="2.*">
<readme type="file" parsebbc="true">readme.txt</readme>
<modification>upgrade_2-0_v-1-0-2.xml</modification>
</upgrade>
Title: Re: Simple Theme Changer
Post by: hcfwesker on May 25, 2011, 12:09:56 AM
^^ installed perfectly with 2.0 RC4!  Everyone just needs to be sure to add the extra bit in the first post.

Just wish it kept you on the same page when selecting themes, but it's better than nothing :)
Title: Re: Simple Theme Changer
Post by: Tanith0709 on July 16, 2011, 11:50:35 AM
Does this work for 2.0?
Title: Re: Simple Theme Changer
Post by: hcfwesker on July 16, 2011, 11:21:00 PM
Sure does.  Read my post above yours.  Even if you have to emulate to RC4, it works, got it on my 2.0 forum
Title: Re: Simple Theme Changer
Post by: hcfwesker on September 02, 2011, 03:07:42 PM
dead support, but was kinda hoping if anyone would know how to change the location of the drop down.  I'd prefer it right below the search box

smf 2.0

http://www.brawldomain.com
Title: Re: Simple Theme Changer
Post by: Matthew K. on September 02, 2011, 03:22:21 PM
Just modify the edits it makes to the template(s).
Title: Re: Simple Theme Changer
Post by: hcfwesker on September 02, 2011, 09:27:44 PM
I think i tried that before, but couldn't get it to align to the right side
Title: Re: Simple Theme Changer
Post by: GraphicJunki on October 17, 2011, 05:50:55 PM
Hi everyone I know very little about php, If somone could tell me to where abouts in the my Themes index.templates do
I paste the following code please.  I have this mod installed on 2.0.1

any help you can give me would be much appreciated

Thanks


echo '
<select id="simple_theme_changer" onchange="switch_theme();">
<optgroup label="', $txt['simple_theme_changer_name'], '">';

foreach ($context['themes'] as $id => $theme)
echo '
<option value="', $id, '"', (($settings['theme_id'] == $id) ? ' selected="selected"' : ''), '>', $theme, '</option>';

echo '
</optgroup>
</select>

<script language="JavaScript" type="text/javascript">
<!--
function switch_theme(){
theme_changer = document.getElementById("simple_theme_changer");
var id = theme_changer.options[theme_changer.selectedIndex].value;
var page = new String(window.location);

window.location = "index.php?action=theme;sa=pick;type=quick;u=', $context['user']['id'] ,';th=" + id + ";sesc=', $context['session_id'], ';page=" + escape(page);
return false;
}
-->
</script>';
Title: Re: Simple Theme Changer
Post by: danielwmoore on November 04, 2011, 12:30:05 PM
This is very close to what I am looking for for 2.0.1.

If all I wanted was for current members to be able to change their themes quickly, then I could easily adapt this.  However, I would like it to be smart enough to detect when a user is logged in, and if so, use this as is.  If no user is logged in (a guest is viewing), then I would still like the drop down, but to change the theme for the current session.  This is possible by calling the theme (and variant for themes with a variant) by the theme number.  Such as 'index.php?theme=8;vrt=blue;variant=blue" would set the current session to use theme number 8, with the "blue" variant.  (I have 9 color variants on one theme, 4 on another.) 

I also need to make sure that the selector doesn't just list the themes, but each variant for a theme.

Is anyone willing to take up this mod and do something like this that will be something everyone could actually use?  Then it would be usable by pretty much every SMF 2.0 forum!
Title: Re: Simple Theme Changer
Post by: hcfwesker on November 09, 2011, 05:17:40 PM
Quote from: saffz on October 17, 2011, 05:50:55 PM
Hi everyone I know very little about php, If somone could tell me to where abouts in the my Themes index.templates do
I paste the following code please.  I have this mod installed on 2.0.1

It's really about where you want it to appear on your forum.  I have it at the bottom of my site, you can see in the link in my sig.  just goto your themes index.template.php file

Find
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!

and place the code directly above it.
Title: Re: Simple Theme Changer
Post by: GraphicJunki on November 09, 2011, 07:51:28 PM
Thanks worked a treat
Title: Re: Simple Theme Changer
Post by: hcfwesker on December 17, 2011, 11:54:55 PM
Just gonna share a more convenient place to put this for members logged in the site.  It'll place the theme selector directly under the search tab.  This is very ideal if you never use the forums' "random news item'

Preview in the attachment below.  If you add it and don't like it, just move it around and see where you rather prefer it to be placed.  This is just a suggestion, and most ideal for custom themes based off the SMF Default Curve theme.

Themes/(your theme)/index.template.php

Find
// Show a random news item? (or you could pick one from news_lines...)

Add BEFORE
echo '
<select id="simple_theme_changer" onchange="switch_theme();">
<optgroup label="', $txt['simple_theme_changer_name'], '">';

foreach ($context['themes'] as $id => $theme)
echo '
<option value="', $id, '"', (($settings['theme_id'] == $id) ? ' selected="selected"' : ''), '>', $theme, '</option>';

echo '
</optgroup>
</select>

<script language="JavaScript" type="text/javascript">
<!--
function switch_theme(){
theme_changer = document.getElementById("simple_theme_changer");
var id = theme_changer.options[theme_changer.selectedIndex].value;
var page = new String(window.location);

window.location = "index.php?action=theme;sa=pick;type=quick;u=', $context['user']['id'] ,';th=" + id + ";sesc=', $context['session_id'], ';page=" + escape(page);
return false;
}
-->
</script>';
Title: Re: Simple Theme Changer
Post by: coolestman on December 18, 2011, 01:42:18 AM
i changed the theme f my site and some features refused to display lke my ads, blogs and articles
Title: Re: Simple Theme Changer
Post by: hcfwesker on December 18, 2011, 02:39:39 AM
Now, did you manually change the theme of your site from your profile, or are you using the Simple Theme Changer MOD?  The way you worded it just makes it seem you saw the title and this was the best place for you to post your problem.

Your issue sounds like you possibly didn't make the manual edits to other themes that those features ask for.
Title: Re: Simple Theme Changer
Post by: coolestman on December 23, 2011, 12:51:26 AM
i changed the theme manually in the admin.
Title: Re: Simple Theme Changer
Post by: hcfwesker on December 23, 2011, 02:29:48 AM
Quote from: coolestman on December 23, 2011, 12:51:26 AM
i changed the theme manually in the admin.

then that has nothing to do with this MOD.  You need to ask for support in those MOD topics.  Most likely you didn't make the edits required to other theme files.
Title: Re: Simple Theme Changer
Post by: felizycontento on September 14, 2017, 01:51:59 PM
Is there any current alternative to this mod? I can't make it work in 2.014
Title: Re: Simple Theme Changer
Post by: br360 on September 14, 2017, 02:18:42 PM
You can try this one- https://custom.simplemachines.org/mods/index.php?mod=3356
Title: Re: Simple Theme Changer
Post by: felizycontento on September 14, 2017, 03:44:26 PM
Quote from: br360 on September 14, 2017, 02:18:42 PM
You can try this one- https://custom.simplemachines.org/mods/index.php?mod=3356

No it doesnt work. This at least shows the switcher, but switching the theme does not have any effect.