SMF Quick Theme Changer

Started by Hambil, April 04, 2007, 01:46:44 PM

Previous topic - Next topic

Hambil

Link to Mod

Keywords: Theme, quick, changer, select

Description:
Adds a drop down theme selector to the footer of all pages

Version 1.0.0:

  • Adds a drop down theme changer to footer.
  • Works with default theme and any theme without its own index.template.php file.
  • Keeps you on the same page when theme is changed.

Install:

  • Download the SMF_Quick_Theme_Changer_1.0.0
  • Import from the package manager.

To install on themes with their own index.template.php file you'll need to make the edits to that file manually. Open the QuickThemeChanger.xml file, look for the changes being made to index.template.php, and hand edit the themes index.template.php file to apply the edits.  

www.catnine.net/smf

shadow82x

#1
Wow thank you so much for this mod its great. I have been waiting for this mod!

==edit===

Is there a way to make it sure on every theme?
Colin B
Former Spammer, Customize, & Support Team Member

ladynada

thank you so much!  Just what I was looking for today.
nada
WORK for Truth, Print it, Take Time to READ ALL LINKS NOTED  click here --> The TWO Witnesses are Mom and Dad and SMF Skins

SacmaliK


My Mods
Veoh Bbc Tag:here
Topic get Keywords:here
...

ladynada

can someone explain how the code keeps the user on the same page after changing the theme?  for me, it only seemed to work on the admin user, but on regular users, it sends you to the forum.

thanks,
nada
WORK for Truth, Print it, Take Time to READ ALL LINKS NOTED  click here --> The TWO Witnesses are Mom and Dad and SMF Skins

kat

#5
EEK! I ended up with four changers and some well-screwed code!

To quatify that, The changer appeared. When I clicked on a theme, the page refreshed but the theme hadn't changed.

I selected, again.

The theme changed, but there were, now, two changers.

If I clicked the top one, the theme changed. If I clicked the bottom one, the theme stayed the same, but three changers appeared.

If I clicked the top one, the theme changed. If I clicked any of the others, the theme stayed as it was and there appeared yet another changer!

Indy74

Very nice mod!

What part of the code i have to paste into template.index.php file in my other themes? I looked on .xml file but everything there seemed to me logical to be copied, lol!

:)

ladynada

This mod was working great for me, but I wanted guests to be allowed to change themes.  I really liked the feature where the user was sent back to where he was.  So, I had to sacrifice the option to _SAVE_ the new theme selection in the user's profile.  I will tell my members to go into their profile and make the change permanent.

I had to make all my edits manually because I run Ultiportal on my setup.

one change I made was that instead of:


loc = \'index.php?action=theme;sa=pick;saa=quick;u=', $context['user']['id'] ,';th=\' + id + \';sesc=', $context['session_id'], ';url=\' + escape(url);


i used this:


loc = \'index.php?theme=\' + id + \';saa=quick\' + \';url=\' + escape(url);



I made no changes to themes.php


in load.php in the sources folder

look for:


// The theme was specified by REQUEST.
elseif (!empty($_REQUEST['theme']) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum')))
{
$ID_THEME = (int) $_REQUEST['theme'];
$_SESSION['ID_THEME'] = $ID_THEME;



and after that put:



if (isset($_REQUEST['saa']) && $_REQUEST['saa'] == 'quick')
redirectexit($_REQUEST['url']);


and, for Ultiportal systems, just add his changes for the homepage's index.php in the same place you did for the index.php for the forum.

you can see how they work on my bbs at http://heartdaughter.com/

again, the change is NOT saved in the user profile.

thanks for this great mod,
nada

WORK for Truth, Print it, Take Time to READ ALL LINKS NOTED  click here --> The TWO Witnesses are Mom and Dad and SMF Skins

Badboy

Great mod. But for users to send back to where they were and to allow guests to select theme...

First please install the original mod.

Then...

Open Themes.php

Find:

redirectexit('action=profile;sa=theme');

Replace with:
if (isset($_REQUEST['saa']) && $_REQUEST['saa'] == 'quick')
{
redirectexit($_REQUEST['url']);
}
else
{
redirectexit('action=profile;sa=theme');
}


Now we have to edit quick_theme_changer function.

So open index.template.php

Find:

var url = new String(window.location);

loc = \'index.php?action=theme;sa=pick;saa=quick;u=', $context['user']['id'] ,';th=\' + id + \';sesc=', $context['session_id'], ';url=\' + escape(url);
window.location = loc;


Replace with:
var url = new String(window.location);';
if (!$context['user']['is_guest'])
{
echo '
loc = \'index.php?action=theme;sa=pick;saa=quick;u=', $context['user']['id'] ,';th=\' + id + \';sesc=', $context['session_id'], ';url=\' + escape(url);
window.location = loc;';
}
else
{
echo '
loc = \'index.php?theme=\' + id;
window.location = loc;';
}
echo '


Now all the users will send back to where they were...

And guests can select theme...
Nothing is true, everything is permitted.

ladynada

THANK YOU THANK YOU THANK YOU!!!

YAY!

nada
WORK for Truth, Print it, Take Time to READ ALL LINKS NOTED  click here --> The TWO Witnesses are Mom and Dad and SMF Skins

kat

Any ideas as to what might be screwing mine?

shadow82x

Quote from: kat on April 09, 2007, 11:16:07 AM
Any ideas as to what might be screwing mine?
Not exactly sure
Colin B
Former Spammer, Customize, & Support Team Member

kat

When I look at ... bugger. Indextemplate, I think it was, the section of code for this mod seems to have replicated.

Most odd.

shadow82x

Quote from: kat on April 09, 2007, 05:26:01 PM
When I look at ... bugger. Indextemplate, I think it was, the section of code for this mod seems to have replicated.

Most odd.

Is it working now? I was going to ask if you got any errors in the installtion
Colin B
Former Spammer, Customize, & Support Team Member

Badboy

Nothing is true, everything is permitted.

kat

Quote from: shadow82x on April 09, 2007, 06:46:50 PM
Quote from: kat on April 09, 2007, 05:26:01 PM
When I look at ... bugger. Indextemplate, I think it was, the section of code for this mod seems to have replicated.

Most odd.

Is it working now? I was going to ask if you got any errors in the installtion
No, it's not. :(

As I say, the code keeps replicating, somehow.

Weird.

There were no errors reported, on installation.

shadow82x

Quote from: kat on April 10, 2007, 06:00:34 AM
Quote from: shadow82x on April 09, 2007, 06:46:50 PM
Quote from: kat on April 09, 2007, 05:26:01 PM
When I look at ... bugger. Indextemplate, I think it was, the section of code for this mod seems to have replicated.

Most odd.
Im not sure what to say

Is it working now? I was going to ask if you got any errors in the installtion
No, it's not. :(

As I say, the code keeps replicating, somehow.

Weird.

There were no errors reported, on installation.
Colin B
Former Spammer, Customize, & Support Team Member

Iron IC

Nice mod :)

I want to manually apply this mod to all my other themes, but sadly, I can`t figure out what and where to edit . Could someone please point out to me what lines of code in the .xlm file I will have to paste into the index.template.php-files? And also give some clues to where in index.template they should be placed. Thanks...

DASBEAN

Quote from: Iron IC on April 10, 2007, 05:44:04 PM
Nice mod :)

I want to manually apply this mod to all my other themes, but sadly, I can`t figure out what and where to edit . Could someone please point out to me what lines of code in the .xlm file I will have to paste into the index.template.php-files? And also give some clues to where in index.template they should be placed. Thanks...

Same here...not sure what to do.


<search position="before"><![CDATA[<table cellspacing="0" cellpadding="3" border="0" align="center" width="100%">]]></search>
<add><![CDATA[
<!-- // Quick Theme Changer Start -->
<tr>
<td colspan="3" style="text-align: left;">
<select name="quick_theme_changer" onchange="quick_theme_changer(this)">
<optgroup label="', $txt['quick_theme_changer'], '">';
foreach ($context['themes'] as $theme)
{
echo '<option value="', $theme['id'], '"', (($settings['theme_id'] == $theme['id']) ? ' selected' : ''), '>', $theme['name'], '</option>';
}
echo '</optgroup>
</select>
</td>
</tr>
<!-- // Quick Theme Changer End -->


Is the code that needs to be added ... I found the line where it replaces, but does the <![CDATA[ get replaced?

Gurnk


Advertisement: