News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SMF Quick Theme Changer

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

Previous topic - Next topic

ladynada

thanks Iron IC,
believe it or not I have never added a mod through the admin, so I do not know what happens!

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

Iron IC

#41
Hehe, I believe you lady nada! The install function from admin works just fine! But as I said, the changes are being made to the forums default theme. Very often a mod doesn`t work if you attemt to install it on a different theme other than SMF default core. I think it is a good idea to always use SMF-core as default theme, unless you run a clean install without any modifications.

Quote from: Badboy on April 09, 2007, 10:33:36 AM
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...


I tried this approach and did it exactly as written above, after installing the original mod from admin first. BUT, why are the users sent to their profile and not to their present page as they are supposed to? I still get these anoying errors in my log. I would really like to know from someone what I can do to correct it.

I`m gonna give your solution another try nada! :)

Thanks.

Iron IC

#42
Just chiming in to tell how things are going.

I have now FINALLY managed to get this thing working for all of my 13 themes! I used your "receipe" nada. :) Did not do anything to themes.php, and simply edited forum index.php and every themes index.template.php file.

It doesn`t work exactly like you said though. Guests can NOT change theme, but that was what I wanted so that`s just sweet. (In one of your first posts in this thread, you talked about editing Load.php. Am I supposed to?).

I would be really satisfied if I could make it so that the user is being sent back to where he was before changing the theme. Any clues? Now they end up on the main page or in their profile...
I got rid of the errors in the log, but only because I disabled it. lol.

ladynada

YIKES!

You are right IRON IC, I did make that change in Load.php in the sources file, and thats how I got it to return you back to where you were.  so, yes you need that.  thank you.

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

Iron IC

Lady Nada.... I think I LOVE YOU!   :-*

That did the trick. Everything works like a charm :)

Thank you so very very much!

Iron IC

ladynada

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

fuddes

Anyone know how to sort the themes in alphabetical order on the pulldown menu?

ProwlingTiger11

This doesnt want to work on my themes. It works on the default, but not my other ones. On the other ones, I can select a new skin, but it wont change....

junglecat

Will this work on version 1.1.3?
PM me for affordable hosting. I will install your SMF forum with your choice of a theme for FREE.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
Join us at Christian Discussions 
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

Teddie63

now for each theme

now, in the index.template.php that you wish to have a theme changer, look for the section where the
copyright is displayed at the bottom of the screen.  You should see above that part, where a script command
ends, and a new table begins.


// ]]></script>
      <table cellspacing="0" cellpadding="3" border="0" align="center" width="100%">
         <tr>


under the </script> insert this part


<!-- // Quick Theme Changer Script -->
   <script language="JavaScript" type="text/javascript">
      function quick_theme_changer(obj)
      {
      var id = obj.options[obj.selectedIndex].value;
      var url = new String(window.location);
      loc = \'index.php?theme=\' + id + \';saa=quick\' + \';url=\' + escape(url);
      window.location = loc;
      }
   </script>
<!-- // Quick Theme Changer End -->


if your theme has been altered, you are looking to insert the theme changer code BETWEEN the <table>
and the <tr>. so insert this:


<!-- // Quick Theme Changer Start -->
   <tr>
      <td colspan="3" style="text-align: center;">
      <select class="skin_changer" 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="selected"' : ''), '>', $theme['name'], '</option>';
            }
      echo '</optgroup>
      </select>
      </td>
   </tr>
<!-- // Quick Theme Changer End -->

you know how to make sure you have an echo ' when needed?  or to shut off echo with a '; when needed?  in case of errors like that?

its easy, I added it to all my themes in a few minutes, always make backups first.

[/quote]

Screaming I can't find this section!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

Teddie63

Never mind I am so sick of messing with this. Nothing in my themes shows a copyright area nor an ending script section.
The more I mess with it the more ticked off I become.
I need a magic wand. LOL

MadnessRed

QuoteAn Error Has Occurred!
You cannot download or install new packages because the Packages directory or one of the files in it are not writable!

I get this with all my packages. I tried to install the first one and it asked me for ftp information so I gave it. Then after that any package I tried to install gives the error. Also the first pack doesn't appear to work. I have version 1.4.1. Any help would be very welcome.

kat

You can change those permissions with your ftp client.

MadnessRed

i have, i have chmodded the entire dircetory and every single file individually to 0777 in fire ftp and again in dream weaver to 777. I tried using a different computer but still no luck

TrueSatan

@ MadnessRed

Your query is not specific to this mod and is thus off topic...if you need further advice on its resolution please post to General English support.

The most likely resolutions are to add a "temp" (sans quotes) directory to your Packages directory and CHMOD it to 777 and if that doesn't resolve the problem to go to ACP>Packages>Options and uncheck "Create Backup versions of replaced files with a tilda (~) on the end of their names."...N.B. when trying to input your ftp information on that screen please use the local path meaning what you see in the navigation breadcrumbs in your ftp client.

Darkness_

Can't this mod made like the style.css changer.

just like this topic  http://www.simplemachines.org/community/index.php?topic=102787.0
(to see the codes, get to the 5th message)


but then like a mod.
sow the dropdown box only let you choose another XXXX_style.css
and how can I change the place off the dropdownbox to underneath the menu?

Neelay

Is this mod known to work with SMF 1.1.5 ? Thanks

2Ntense

Trinny and MadnessRed's errors are probably both because there's a subdirectory in the ZIP file.  The attached file is using the methodology of all of the other mods I've seen (no included subdirectory) which oughta fix both problems.  O:)

The parser I used had a similar error to Trinny's until I got rid of the subdir.  I've seen the Package Installer get stuck in that weird FTP loop when it's trying to chmod a file or directory that doesn't exist.  The most likely cause is the subdir in the original ZIP, but it would also happen if you didn't have $languagedir/index.english.php on your forum.

And yeah, it works just fine with 1.1.5.  You still have to manually add it in to all of your other themes that have their own unique index.template.php, though.

I AM Legend

Hi All,
My Forum version was 1.1.5, just updated to 1.1.6.
I installed the quick theme select mod, it works great, no major issues at all.
1 minor issue, is there a way to code edit it so it does not show on the outside of the forum when logged off?.
If so, what code do I need to edit and where?.
Thanks.

antechinus reply was: Yep. Presumably it has an echo' before the changer code so you just add if($context['user']['is_logged']) before that.

I'm assuming that code would be in index.template but you really should ask in the mod thread. The person who made the thing will know.

he didnt say where to add it, as in: Find?? replace with??.

Any help would be awesome thanks.

Fustrate

In index.template.php find
<!-- // Quick Theme Changer Start -->
replace it with
';
if($context['user']['is_logged']){
echo '
<!-- // Quick Theme Changer Start -->


and replace
<!-- // Quick Theme Changer End -->
with

<!-- // Quick Theme Changer End -->';
}
echo '
Steven Hoffman
Former Team Member, 2009-2012

Advertisement: