The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

ThemeSwitcher by Darren Optimisation

View previous topic View next topic Go down

Solved ThemeSwitcher by Darren Optimisation

Post by ioncube on November 16th 2011, 1:37 am

@ http://help.forumotion.com/t71484-add-multi-themes-to-your-forum

I hope after reading this the author edits the original code.

Problems via author's method
1] Not working in IE9
2] Absolute positioning plays havoc with theme
3] Why change css of 'select' tag when we can use the builtin
4]Higher loading time

With customisations:
Opposite of the four above Very Happy
Plus you can place the dropdown anywhere & not just at the top left corner.

Will only discuss customisations rest you have to follow author's steps

get rid of this block

Code:
document.write('<style>body {margin-top:50px !important;} select {color: #fff !important; background-color: #000 !important;}  option {font-family: verdana; font-size: 10px; color: white;} option.sl {color: #fff !important; background-color: #000;} SELECT{ font-family: verdana; font-size: 10px; color: white; </style>');
problem 2] 3] solved

place all of this in javascript file via js management
Code:
var scheme = getCookie('template1');
if (scheme == 'Defaul') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="(DEFAULT THEME)http://testorial.forumotion.com/169155-ltr.css">');
} else if (scheme == 'Black') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="(CUSTOM THEME 1)http://testorial.forumotion.com/169154-ltr.css">');
} else if (scheme == 'Purple') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="(CUSTOM THEME 2)http://testorial.forumotion.com/168970-ltr.css">');
} else if (scheme == 'Yellow') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="(CUSTOM THEME 3)http://testorial.forumotion.com/168975-ltr.css">');;
}

function changeskin(change) {
var scheme = change;
var name = 'template1';
var pathname = location.pathname;
var myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';
var ExpDate = new Date ();
ExpDate.setTime(ExpDate.getTime() + (180 * 24 * 3600 * 1000));
setCookie(name,scheme,ExpDate,myDomain);
}
function getCookie(name){
var cname = name + "=";
var dc = document·cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}

function setCookie(name, value, expires, path, domain, secure) {
document·cookie = name + "=" + escape(value) +
((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
((path == null) ? "" : "; path=" + path) +
((domain == null) ? "" : "; domain=" + domain) +
((secure == null) ? "" : "; secure");
}
problem 4] solved
place this as html wherever you want the dropdown to appear
Code:
<script type=text/javascript>document.write('<div style="position: absolute; width: 150px; height: 38px; z-index: 1; left: 5px; top: 10px" id="skinselector"><form><select onchange="changeskin(this.options[this.selectedIndex].value); window.location.reload();"><option class="sl"> Change the Skin </option><option class="sl" value="Defaul"> Default </option><option class="sl" value="Black"> CUSTOM THEME 1</option><option class="sl" value="Purple"> CUSTOM THEME 2</option><option class="sl" value="Yellow"> CUSTOM THEME 3 </option></select></form></div>');</script>
problem 1] solved

You are all set...
In the coming days I hope someone changes the core script to create cookies via FM's builit
Code:
my_setCookie()
feature but now I am working on a very simple switcher (its in progress Razz )

ioncube
Forumember

Male Posts : 279
Reputation : 41
Language : eng
Location : Pakistan

http://defencedog.blogspot.com/

Back to top Go down

Solved Re: ThemeSwitcher by Darren Optimisation

Post by kirk on November 16th 2011, 2:48 am

why dint you just PM Darren about this?

kirk
Forumaster

Male Posts : 11037
Reputation : 651
Language : English,Vulcan,Klingon, Romulan,& Gorn

Back to top Go down

Solved Re: ThemeSwitcher by Darren Optimisation

Post by ioncube on November 16th 2011, 2:51 am

you may be right, but I let people play with it & by their feedback even I may know whether I am right, but I wil PM him now

ioncube
Forumember

Male Posts : 279
Reputation : 41
Language : eng
Location : Pakistan

http://defencedog.blogspot.com/

Back to top Go down

Solved Re: ThemeSwitcher by Darren Optimisation

Post by kirk on November 16th 2011, 3:08 am

well copy the post and save it, then when yous have it worked out it can be submitted,

I dont want to leave it here until it's working how it should be.
I dont have the time to test it all myself Sad

kirk
Forumaster

Male Posts : 11037
Reputation : 651
Language : English,Vulcan,Klingon, Romulan,& Gorn

Back to top Go down

Solved Re: ThemeSwitcher by Darren Optimisation

Post by ioncube on November 16th 2011, 3:29 am

well from my side I have tested in all browsers you do get all the benefits I listed. I assure you its not buggy. Keep it here until Darren comes I had PM him

ioncube
Forumember

Male Posts : 279
Reputation : 41
Language : eng
Location : Pakistan

http://defencedog.blogspot.com/

Back to top Go down

Solved Re: ThemeSwitcher by Darren Optimisation

Post by kirk on November 16th 2011, 4:09 am

yeah ok i will for now.
Next time please pm anyone that has a tutorial on here that you may be modifying or have another method for,

kirk
Forumaster

Male Posts : 11037
Reputation : 651
Language : English,Vulcan,Klingon, Romulan,& Gorn

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum