miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

CSS Skin changing code using cookies and GET parameter

 
 
Page  Page 1 of 2:  1  2  Next »

Author Lajos
Partaker
#1 | Posted: 26 Mar 2006 21:08 
Hi miniBBteam

At first I would like to thank for this great forum package.
I'm not a professional in PHP (and english!) just like the web design and spend a lot of time with it.
In brief I was searching a solution in this forum and the NET to change the outlook of forum simply,
but did'nt find any useful thing.
Finally I have applied the next my idea to five different skin (including default):

Download the css files,
In my case:
bb_black_style.css, bb_brown_style.css, bb_green2_style.css, bb_macgrey_style.css
If you want to be same all style edit the next rows in the styles by the standard default:
-----------------------
table.forums {
width: 770px;
---------------------
.tbTransparent{
width: 770px;
background: transparent;
font-size: 12px;
text-align: left;
}
--------------------------
Open index.php and setup.options.php //EditPlus or notebook/
Edit the next rows:
In index.php
from: include ('./setup_options.php'); to include ('./setup_options_bl.php');
Save as index_bl.php //for black style//
----------------------------------
in index.php
from: include ('./setup_options.php'); to include ('./setup_options_br.php');
Save as index_br.php //for brown style//
-----------------------------------------------------------
...So on till any number of style
---------------------------------------------------------------------- ------------------------------------------
In setup_options.php
from $skin='default'; to $skin='black';
from $indexphp='index.php?'; to $indexphp='index_bl.php?';
from $startIndex='index.php'; to $startIndex='index_bl.php';
Save as setup_options_bl.php //for black style//
----------------------------------------------------
...So on till any number of style
---------------------------------------------------------------------- --------------------------------------------
Open main_header.html and put five link with name blue-black-brown-green-grey to index.php(blue-default)
index_bl.php (black), index_br.php (brown) .....etc.

If you have direct link to the rules (rules.html) or other file, paste
the next link after the {$l_menu[9]} (or after the last element)
<a href="http:?action=tpl&tplName=rules">Rules</b>
Save and copy under templates

In the rules.html between head and head
<link href="https://www.minibb.com/forums/bb_{$skin}_style.css" type="text/css" rel="STYLESHEET">
Save and copy under templates

At the end of your editing you have five index.php:
index.php //default
index_bl.php //black
index_br.php //brown
index_gr.php //green
index_mg.php //macgrey

five setup_options.php:
setup_options.php
setup_options_bl.php
setup_options_br.php
setup_options_gr.php
setup_options_mg.php

and five css files:
bb_default_style.css
bb_black_style.css
bb_brown_style.css
bb_green2_style.css
bb_macgrey_style.css

Copy into the root
Of course this style changing solution does'nt work between files, since if anybody wants to change style under registration process
(for example) the result will be a new start page.

It works on my site: http://www.antennalap.hu

Lajos

Author tom322
Guest
#2 | Posted: 26 Mar 2006 22:52 
I think from the designer's point of view that's a very interesting idea. But from the Seo point of view -- hmm, the spiders are likely to index all index_color.php pages and it may result in duplicate content penalties (unless you exclude spiders to crawl the unnecessary pages in robots.txt -- but I don't think all spiders even follow their own rules ;).

Author Team
8-)
#3 | Posted: 27 Mar 2006 07:17 
Yes, this works, but everything should be done even simplier, as tom322 mentions... with one index file. For example, when you open an URL like index.php?changeTheme=brown or index.php?changeTheme=blue it is handled in bb_plugins.php and the code sets long-term cookie idendtifying the theme. After it, code in setup_options.php locates this cookie's value, and sets $skin correspondly.

Author Lajos
Partaker
#4 | Posted: 27 Mar 2006 18:34 
Thanks for your advices. I'll try it.

Lajos

Author Lajos
Partaker
#5 | Posted: 29 Mar 2006 16:31 
Hi
I took same attempts to realizate the above idea by Team, but I think that on my level I need more detail (step by step) if it's possible.
If my request takes up a lot of time let's forget it.

Thanks

Does the system allow to post message without login?

Author Team
8-)
#6 | Posted: 30 Mar 2006 10:41 
Does the system allow to post message without login - yes, we have our forums opened for anyone by default. You can set them up in settings for registered users only.

Ok, here is the code you need to put at the very end of setup_options.php:

/* skin changing code hack */
if(isset($_GET['changeTheme'])){
$cs=$_GET['changeTheme'];
if(file_exists("{$pathToFiles}bb_{$cs}_style.css")) {
$skin=$cs;
setcookie($cookiename.'_theme', $skin, time()-2592000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename.'_theme', $skin, time()+2592000, $cookiepath, $cookiedomain, $cookiesecure);
}
}
elseif(isset($_COOKIE[$cookiename.'_theme'])){
$cs=$_COOKIE[$cookiename.'_theme'];
if(file_exists("{$pathToFiles}bb_{$cs}_style.css")) $skin=$cs;
}
/* --skin changing code hack */


then point your link URLs with "changeTheme=SKIN_NAME" parameter. For example, if you have "classic" and "white" skins installed, URLs will be:

index.php?changeTheme=classic
index.php?changeTheme=white

etc. Hope that's clear enough.

Author Lajos
Partaker
#7 | Posted: 30 Mar 2006 22:10 
Thanks for your care about me, now the solution is absolutely clear.

Lajos

Author MKJ
Partaker
#8 | Posted: 2 Aug 2006 13:32 
Hi

Very cleverly done and nearly perfect for my use which is to show demos of various portals and forums. I have the above hack working but there is a problem with attempting to demonstrate different styles as the above only changes the style.css. Can it be added to so that the main_header.html file be altered as well on each theme change? Could I perhaps alter the main_header file so that it finds the logo from the style.css file of each theme? Would like to get minibb on the theme site as soon as possible since I use the forum on my main site.

Regards
MKJ

Author Paul
Lead Developer 
#9 | Posted: 2 Aug 2006 19:42 
Didn't get completely, what you mean, but you can probably assign various logos, basing also on $cs variable... Something like:

/* skin changing code hack */
$defaultLogo='logo.gif';
if(isset($_GET['changeTheme'])){
$cs=$_GET['changeTheme'];
if(file_exists("{$pathToFiles}bb_{$cs}_style.css")) {
$skin=$cs;
$defaultLogo="logo_{$cs}.gif";
setcookie($cookiename.'_theme', $skin, time()-2592000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename.'_theme', $skin, time()+2592000, $cookiepath, $cookiedomain, $cookiesecure);
}
}
elseif(isset($_COOKIE[$cookiename.'_theme'])){
$cs=$_COOKIE[$cookiename.'_theme'];
if(file_exists("{$pathToFiles}bb_{$cs}_style.css")) {
$skin=$cs;
$defaultLogo="logo_{$cs}.gif";
}
}
/* --skin changing code hack */

Then the HTML code for the logo in main_header.html will be:

<img src="https://www.minibb.com/forums/img/{$defaultLogo}" alt="ALT_HERE" />

Of course, put all necessary logos, named correspondingly to your stylesheet's $cs var into /img/ directory.


Parsing of main_header.html is hard-coded in miniBB functions, and there is no way to change it, else modifying them... I think, there are less destructive methods, like suggested.

Author MKJ
Partaker
#10 | Posted: 2 Aug 2006 20:25 
Good work. Took a while to figure out a few things and I haven't had to alter the style.css code at all but just rename the logo.gifs to suit. Works a treat so I can now put loads of themes up for display. The theme demos are proving very popular and I intend to show lots of others too so the traffic should increase.

Regards
MKJ

Author daniel gerzo
Guest
#11 | Posted: 2 Aug 2006 21:28 

Author MKJ
Partaker
#12 | Posted: 5 Aug 2006 11:42 
The logo changing hack is working a treat. Only one more thing I need really and that is the forum icon needs altering too on some themes. How can I add forum icon change to the above?

Regards
MKJ

Author Paul
Lead Developer 
#13 | Posted: 5 Aug 2006 13:15 
By the same logic... use prefix like described, and then create separate folder for each forum icons with that prefix. For example, [forum_theme1_icons], [forum_theme2_icons], where "theme1", "theme2" depend on $cs variable's value. Then place all icons with default names into that folders, and change folder titles in templates like

main_forums_cell.html
main_last_discuss_cell.html
main_topics_cell.html
main_posts.html

from [forum_icons] to [forum_{$cs}_icons]

Not sure it will work, but at least it should...

Author stevan
Guest
#14 | Posted: 19 Oct 2007 07:37 
how change css only for forum=17

Author Paul
Lead Developer 
#15 | Posted: 19 Oct 2007 09:07 
Put this in bb_plugins.php:

if($forum==17) $skin='name_of_skin_for_this_forum';

then CSS file should be named bb_name_of_skin_for_this_forum_style.css

Page  Page 1 of 2:  1  2  Next » 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 CSS Skin changing code using cookies and GET parameter
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Private Messaging add-on: allow your miniBB-forums members to communicate with each other.


  ⇑