|
Joined: Jun 2002
Posts: 9
Lurker
|
Lurker
Joined: Jun 2002
Posts: 9 |
does ubbt support dymanic style sheet changing?
|
|
|
|
Joined: Nov 2001
Posts: 10,369
I type Like navaho
|
I type Like navaho
Joined: Nov 2001
Posts: 10,369 |
What do you mean? User's can select their own stylesheet and change it whenever they want - you also can define stylesheets to sepcific forums. 
|
|
|
|
Joined: Jun 2002
Posts: 9
Lurker
|
Lurker
Joined: Jun 2002
Posts: 9 |
well im making a site and pending if this works as planned, a user can select a color scheme (blue or ornage) and itll change the css as needed on the fly. example: http://www.lestercat.net/dev/CSS_Demo/Alternate_Style_Sheets.htmlbut im curious if ubbt would allow this to function for it as well as the rest of the site. cuz it would look dumb with the rest of the site looking different than the forums imo.
|
|
|
|
Joined: Nov 2001
Posts: 10,369
I type Like navaho
|
I type Like navaho
Joined: Nov 2001
Posts: 10,369 |
Hmm.. not sure. There would be no need to do that as each user can select their own preferences in their display prefs.
But if it's just one stylesheet that acts like that - then it should still behave like that. You'd probably need to test it to be sure.
|
|
|
|
Joined: Dec 2000
Posts: 1,471
Addict
|
Addict
Joined: Dec 2000
Posts: 1,471 |
As Josh said, users can define their style in the user preferences, but it shouln't be difficult to change with clicking a link. You don't need to do that with javascript, you could simply alter the apropriate user field in the database and reload the page.
|
|
|
|
Joined: Mar 2000
Posts: 21,079 Likes: 3
I type Like navaho
|
I type Like navaho
Joined: Mar 2000
Posts: 21,079 Likes: 3 |
For instantaneous changing, you can pre-load them with javascript... limit in your theme settings to one style then load the others with javascript as alternate styles .css
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
Okay, I have it working somewhat. What I did was download the script from that page and uploaded it to my server. I then added the following code to my header-insert: <script type="text/javascript" <br />src="http://www.drumlines.org/scripts/styleswitcher.js"></script> <br /> <br /><link rel="alternate stylesheet" <br />type="text/css" href="http://www.drumlines.org/betathreads/stylesheets/aqua.css" <br />title="aqua" /> <br /> <br /><link rel="alternate stylesheet" <br />type="text/css" href="http://www.drumlines.org/betathreads/stylesheets/mocha.css" <br />title="mocha" /> I then went into ubbt_header.tmpl and changed: <link rel="stylesheet" href="$stylesheet" type="text/css" /> to this: <link rel="stylesheet" href="$stylesheet" type="text/css" title="default" /> I then made a post, in HTML, of this: <a href="#" onclick="setActiveStyleSheet('aqua'); return false;">Change style to Aqua</a> <br /> <br /><a href="#" onclick="setActiveStyleSheet('mocha'); return false;">Change style to Mocha</a> <br /> <br /><a href="#" onclick="setActiveStyleSheet('default'); return false;">Change style back to your default.</a> It affects all users, not just you.  If anyone knows a thing or two about cookies, I'm sure that will solve the problem.
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
P.S. I wish I could show you an example, but it seems to affect the whole site for everyone, so I have posted it in a private area. JoshPet and Omegatron have access to tinker with it though. P.P.S. If you try this JoshPet and/or Omegatron, it will only work at my /betathreads install.
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
Oh yeah, to answer the initial question, I hypothesise (sp) that this would work site-wide as long as the script and stylesheet headers are in every file and you use identical class tags to UBB throughout your site.
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
After more hacking, I believe it probably doesn't affect all users, but rather writes the style to your cookie in such a way that the My Cookies clear does not erase it. Probably because it was not written with this in mind. So deleting your cookies will do the trick of returning everything to normal.
Again, if anyone out there has any cookie experience, I believe this will be the icing on the cake.
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
You have to click back to default, then clear your cookies. It acts like it's somehow remembering what was last clicked without using a cookie. [twilight zone music /]
|
|
|
|
Joined: Apr 2001
Posts: 3,266
Member
|
Member
Joined: Apr 2001
Posts: 3,266 |
From initial looking it does not change every user. Here are some tidbits from what I found and need work on. In Internet Explorer one needs the links to click to change stylesheets. In Mozilla there is a nice little box on the bottom left corner of window that allows you to instantly change themes. However as expected the change a user makes is only good for one window and when the page refreshes it goes back to the user's default. Basically the javascript allows switching of the stylesheets. What needs to happen is a script to be written upon action of the stylesheet change to rewrite the user's cookie with the updated stylesheet then the change would take place on how many pages the user wanted and changing would simply be clicking the box to change it. Or of course logging out. Rewriting the cookie routine on the fly is more complicated than most things but doable using the present code in threads to another script allowing the stylsheet variable when switching to be passed to the cookie. Since I assume 6.4 has an updated cookie routine when it goes final it might be something worthwhile to look into as far as hacks are concerned.
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
Changing pages does make the default style re-appear, but then it changes to what what previously chosen upon completion of the page load.
|
|
|
|
Joined: Apr 2001
Posts: 3,266
Member
|
Member
Joined: Apr 2001
Posts: 3,266 |
Beg to differ The page is loaded back to the default set by the user's cookie which is what is pulled from the database and in the intitial cookie. The problem being this mod allows switching but the user cookie is not updated. Now the Javascript works in IE and will update the page after loading completes. However there is no nice fancy switcher in IE. One must click those links you provide. Now in Mozilla you get a nice fancy box which allows switching on the fly. However the page when done does not reload to the alternative stylesheet.
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
An update on this... I guess I had loaded too many styles into my header, because my moderators said the site would lock-up their browser. I using about 20 or so styles, so I guess that's pushing it.  Still a lot of odd behaviour by this though. Anyone else tinkering with this?
|
|
|
|
Joined: Mar 2000
Posts: 21,079 Likes: 3
I type Like navaho
|
I type Like navaho
Joined: Mar 2000
Posts: 21,079 Likes: 3 |
I plan to do it with a .classic forum, I'll let ya know what problems/fixes I see 
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
Thanks! 
|
|
|
|
Joined: Dec 2000
Posts: 1,471
Addict
|
Addict
Joined: Dec 2000
Posts: 1,471 |
You could avoid these problems by not using javascript but php for switching the css-files. This way, your users can change the style even if they have javascript disabled.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 417
Joined: November 2001
|
|
Forums63
Topics37,571
Posts293,923
Members13,848
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|